Subscribe

UiPath Marketplace

The UiPath Marketplace Guide

Quickstart - Get Teams, Channels, and Messages

Overview

The purpose of this guide is to help you create a working sample that uses different Microsoft Teams activities, including the Get Teams, Get Channels, Get Messages, and Get Replies activities.

This working sample enables you to quickly verify the connection to your registered Microsoft Teams application and get familiar with the activity's input/output datatypes.

After completing the steps in this guide, you'll have an automation sequence that does the following:

  1. Establishes a connection to your registered Microsoft Teams application (Microsoft Teams Scope).
  2. Finds and returns a team that matches your team search query (Get Teams).
  3. Finds and returns channel, from your specified team, that matches your channel search query (Get Channels).
  4. Retrieves all messages from your specified channel (Get Messages).
  5. Verifies the messages were retrieved by outputting the message body content and returning any message replies (For Each and Write Line, and Get Message Replies).

Quickstart message sequence diagram (how it works)

Prerequisites

Before you begin:

  1. Complete the Microsoft Teams Setup steps.
  2. Create or use an existing Team and Channel, send at least one message and reply to that message.
    • To use the same values as we do in this guide, create and send the following:
      • Team name: Quickstart_Test1
      • Channel: QS4_Channel
      • Message 1: Hello from UiPath!
      • Reply 1: Hey, hey, hey
      • Reply 2: So happy to be here!
      • Message 2: What time is the meeting?
      • Reply 1: 11am

Steps

Build your project

  1. Add the Microsoft Teams Scope activity to your project.
  2. Enter the ApplicationId for your registered application.
  3. From the AuthenticationType drop-down list, select the applicable authentication flow (e.g., InteractiveToken).
  4. Add the Get Teams activity after the Microsoft Teams Scope activity.
  5. Select the type of teams that you want to retrieve from the ListType drop-down list (e.g. MyJoinedTeams)
  6. Enter your QueryOptions to find a specific team from your list of teams (e.g., {New QueryOption("filter", "displayName eq 'Team Name'")}).
    • For more information, see the QueryOptions section in the Get Teams activity page.
  7. Create and enter a Team[] variable for your Teams value (e.g., myTeams).
    • When creating your variable, select Microsoft.Graph.Team as the variable type.
  8. Add the Get Channels activity after the Get Teams activity.
  9. Enter your QueryOptions to find a specific channel from your specified team (e.g., {New QueryOption("filter", "displayName eq 'Channel Name'")}).
    • For more information, see the QueryOptions section in the Get Channels activity page.
  10. In the TeamId property, enter the Team[] variable you created for the Get Teams activity. To enter a String value, specify the item in the array and append .Id to the end of the variable (e.g., myTeams(0).Id).
  11. Create and enter a Channel[] variable for your Channels value (e.g., myChannels).
    • When creating your variable, select Microsoft.Graph.Channel as the variable type.
  12. Add the Get Messages activity after the Get Channels activity.
  13. In the ChannelId property, enter the Channel[] variable you created for the Get Channels activity. To enter a String value, specify the item in the array and append .Id to the end of the variable (e.g., myChannels(0).Id).
  14. In the TeamId property, enter the Team[] variable you created for the Get Teams activity. To enter a String value, specify the item in the array and append .Id to the end of the variable (e.g., myTeams(0).Id).
  15. To limit the number of messages that you'll output, enter a low number in the Limit property (e.g., 5).
  16. Create and enter a ChatMessage[] variable for your Messages value (e.g., myMessages).
    • When creating your variable, select Microsoft.Graph.ChatMessage as the variable type.

Test your project

  1. To test that your activities retrieved the Team, Channel and Messages, add a For Each activity after the Get Messages activity.
    1. In the TypeArgument property, select Microsoft.Graph.ChatMessage.
    2. In the Values property, enter the ChatMessage[] variable you created for the Get Messages activity (e.g., myMessages).
  2. In the For Each activity, add a Write Line activity.
    1. In the Text property, enter "Message: "+ item.Body.Content
  3. Add the Get Message Replies activity after the Write Line activity.
    1. In the ChannelId property, enter the Channel[] variable you created for the Get Channels activity. To enter a String value, specify the item in the array and append .Id to the end of the variable (e.g., myChannels(0).Id).
  4. To limit the number of messages that you'll output, enter a low number in the Limit property (e.g., 2).
  5. In the MessageId property, enter Item.Id to get each of the retrieved messages' replies.
  6. In the TeamId property, enter the Team[] variable you created for the Get Teams activity. To enter a String value, specify the item in the array and append .Id to the end of the variable (e.g., myTeams(0).Id).
  7. Create and enter a ChatMessage[] variable for your MessageReplies value (e.g., myReplies).
    • When creating your variable, select _Microsoft.Graph.ChatMessage_as the variable type.
  8. Add another For Each activity after the Get Message Replies activity.
    1. In the TypeArgument property, select Microsoft.Graph.ChatMessage.
    2. In the Values property, enter the ChatMessage[] variable you created for the Get Message Replies activity (e.g., myReplies).
  9. In the For Each activity, add a Write Line activity.
    1. In the Text property, enter "Reply: "+ item.Body.Content
  10. Click Run and verify the Output window includes your messages and their associated replies.

You're done!

When you're ready, try the other Quickstart guides to get more familiar with the different Microsoft Teams activities.

To learn more about the Microsoft Teams activities (including example property inputs/outputs), see the following activity pages for a complete activity list and links to the activity detail pages.

Updated 10 months ago


Quickstart - Get Teams, Channels, and Messages


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.