UiPath Documentation
marketplace
latest
false
重要 :
请注意,此内容已使用机器翻译进行了本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

Marketplace 用户指南

上次更新日期 2026年4月1日

Quickstart - get chats and send message

概述

The purpose of this guide is to help you create a working sample that uses different Microsoft Teams activities, including the Get Chats, Get Chat Members, Send Message and Get Message 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.

完成本指南中的步骤后,您将获得一个自动化序列,该连接器将执行以下操作:

  1. Establishes a connection to your registered Microsoft Teams application (Microsoft Teams Scope).

  2. Retrieves all of your chats (Get Chats).

  3. Retrieves the members of each of your chats (For Each and Get Chat Members).

  4. Locates the chat that includes a specific chat member and sends a message (If, Assign, and Send Message.

  5. Verifies the message was sent successfully by retrieving and outputting the message Id and message content Get Message and Write Line).

    docs image

先决条件

在开始之前:

  1. Complete the Microsoft Teams Setup steps.
  2. 创建或使用现有聊天,发送至少一条聊天消息。

步骤

构建项目

  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 (for example, InteractiveToken).
  4. Add the Get Chats activity after the Microsoft Teams Scope activity.
    1. Create and enter a Chat[] variable for your Chats value (e.g., myChats).
      • When creating your variable, select *Microsoft.Graph.Chat
      • as the variable type.
    2. Add a For Each activity after the Get Chats activity.
    3. In the TypeArgument property, select Microsoft.Graph.Chat.
    4. In the Values property, enter the Chat[] variable you created for the Get Chats activity (e.g., myChats).
  5. In the For Each activity, add an Assign.
    1. Create and enter a String variable for the To property (e.g., chatId)
    2. In Value property, enter item.Id.
      • Creating and assigning the *item.id
      • value to this variable enables it to be used in a later For Each activity that has a different argument type.
    3. Add the Get Chat Members activity after the Assign activity.
    4. In the ChatId property, enter Item.Id to get the members for each chat.
    5. Create and enter a ConversationMember[] variable for your ChatMembers value (e.g., myChatMembers).
      • When creating your variable, select *Microsoft.Graph.ConversationMember
      • as the variable type.
    6. Add another For Each activity after the Get Chat Members activity.
    7. In the TypeArgument property, select Microsoft.Graph.ConversationMember.
    8. In the Values property, enter the ConversationMember[] variable you created for the Get Chat Members activity (e.g., myChatMembers).
  6. In the For Each activity, add an If activity.
    1. In the Condition property, enter a value to identify a specific chat by member (e.g., item.DisplayName="Sarah Connor")
  7. In the Then sequence block, add the Send Message activity.
    1. In the ChatId property, enter the String variable you created for the Assign activity (e.g., chatId).

    2. Enter your Body content that you want to send (e.g., "Just saying hi")

    3. In the BodyType property, enter BodyType.Text.

    4. Create and enter a new String variable for your MessageId value (e.g., newMessageId)

      docs image

测试您的项目

  1. To test that your activities retrieved your Chats, the Chat Members, and sent a Message, add a Write Line activity after the Send Message activity.

    1. In the Text property, enter the String variable you created for the Send Message activity (e.g., newMessageId)
  2. Add the Get Message activity after the Write Line activity.

    1. In the ChatId property, enter the String variable you created for the Assign activity (e.g., chatId).

    2. In the MessageId property, enter the String variable you created for the Send Message activity (e.g., newMessageId).

      3 . Create and enter a ChatMessage variable for your Message value (e.g., newMessage).

      • When creating your variable, select Microsoft.Graph.ChatMessage as the variable type.
    3. Add another Write Line activity after the Get Message activity.

    4. In the Text property, enter the ChatMessage variable you created for the Get Message activity and append .Body.Content to the end of it (e.g. newMessage.Body.Content)

  3. Click Run and verify the Output window includes your sent message Id and content.

    docs image

操作完毕!

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

要了解有关 Microsoft Teams 活动(包括示例属性输入/输出)的更多信息,请参阅以下活动页面以获取完整的活动列表以及指向活动详细信息页面的链接。

  • 概述
  • 先决条件
  • 步骤
  • 构建项目
  • 测试您的项目

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新