A reusable Power Platform snippet

SharePoint Get Items - Asset List (Topic with Adaptive Card)

This is a snippet that demonstrates how to use the SharePoint - Get items action as a connector action in a topic. It uses a custom adaptive card as the output to show a table of items.

Copilot Studio
Preview PNG
Last updated
Jul 30, 2024
Category
Community snippet

From idea to implementation

Make it your own.

Check this snippet's prerequisites, permissions, and licensing before using it. The documentation below comes directly from the snippet README.

This is a snippet that demonstrates how to use the SharePoint - Get items action as a connector action in a topic. It uses a custom adaptive card as the output to show a table of items using the SharePoint Asset list template.

A view of examples of getting a list of available laptops

Authors

Snippet Author(s)
SharePoint Get Items - Asset List (Topic with Adaptive Card) April Dunnam (@aprildunnam)

Minimal path to awesome

Enable dynamic chaining before proceeding

  1. Open a copilot in Copilot Studio
  2. Select Generative AI
  3. Scroll down to Dynamic Chaining with generative actions (preview) and enable it by flipping the toggle on

Setup the Action

  1. Select Actions

  2. Select + Add an action

  3. Search for SharePoint Get Items and select the Search button

  4. Select the Get Items action from the SharePoint connector

  5. Select Next

  6. Select Finish

  7. Select the SharePoint - Get Items action in the list (select the name)

  8. Select the ... in the upper right corner and select Open code editor

  9. Make sure to copy the name of the connection reference

    View of the code editor with a red line around the connection reference name

Setup the SharePoint List

This snippet connects to a SharePoint list which will need to be configured before you setup the topic. Follow these steps to setup the list:

  1. Go to your SharePoint site and select New and List View of the code editor with a red line around the connection reference name
  2. From the list of templates, select the Asset Manager template View of the code editor with a red line around the connection reference name
  3. In the pop-up, select Use this template
  4. Give your list a name (keep track of this to use in later steps) and select Create
  5. In the newly created list, scroll all the way to the right and select Add column View of the code editor with a red line around the connection reference name
  6. Choose Hyperlink as the column type and click Next
  7. For the Name type Image and click Save

Configure the Topic

  1. Select the Topics tab

  2. Select Add Topic and From Blank View of the add topic

  3. Rename your topic in the upper left hand corner to something relevant and remember this name.

  4. Select the more button in the upper right hand corner and Open in code editor View of open in code editor

  5. Paste the contents of the YAML-file in the code editor

  6. Replace { REPLACE-WITH-CONNECTION-REFERENCE-NAME } with the connection reference name you copied two steps earlier

  7. Replace { REPLACE-WITH-COPILOT-NAME } with the copilot schema name

  8. Replace { REPLACE-WITH-TOPIC-NAME } with the topic name

  9. Replace { REPLACE-WITH-SHAREPOINT-SITE-URL } with the url of the SharePoint site name

  10. Replace { REPLACE-WITH-SHAREPOINT-LIST-GUID } with the GUID of the SharePoint list name

  11. Save the topic

  12. Test out the topic by using the Test copilot section and send What are the available devices?

  13. Select the device type from the multiple choice list View of choice selection

  14. When you get a list of devices, you're done!

    View of the plugin action where the user asks for available smartphones

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.