activities
latest
false
重要 :
请注意此内容已使用机器翻译进行了部分本地化。
生产力活动
Last updated 2024年9月27日

交互式令牌

概述

  • 运行:作为用户。
  • 场景:Attended 自动化。
  • 委派权限。
注意:这与 Integration Service 中支持的身份验证方法相同,即通过公共 UiPath 应用程序或私有自定义应用程序(自带应用程序方法)进行身份验证。

详细信息

  • Interactive Token authentication type can be used for attended automation and when multi-factor authentication (MFA) is required. This is the default option and what we use in our examples. If you're interested in trying out the activity package, this option is easy to configure and works well for personal accounts (using the default redirect URI noted in step 7 of the Register your application section of the guide).
  • You have the option of registering and using your own Azure app (i.e., OAuthApplication = UiPath) or the one provided by UiPath (OAuthApplication = Custom):
    • UiPath Public App registration: The advantage of using the UiPath public app is that you don't need to configure or maintain the application Note: UiPath does not store any user data. The authentication token is saved only on your machine or in your Orchestrator bucket. See UiPath Public App registration.
    • Custom App registration: The advantage of using your own custom app is that you can manage, customize, and assign permissions within your organization more granularly. See How to create an application for Microsoft 365 Scope connections.
  • When you create a custom application, you must select an application type. For interactive token authentication, use a mobile/desktop application (which uses OAuth 2.0 authorization code flow).
  • When you run the Microsoft 365 activity for the first time using this authentication type, you are prompted to authorize access to the resources (you granted permissions to when registering your app) via a consent dialogue box. See Get access on behalf of a user.
  • A single organization can have multiple application (client) IDs. Each application (client) ID contains its own permissions and authentication requirements. For example, you and your colleague can both register a Microsoft 365 application in your company's Azure Active Directory with different permissions. Your app can be configured to authorize permissions to interact with files only, while your colleague's app is configured to authorize permissions to interact with files, mail, and calendar.
  • If you select this authentication type in Microsoft 365 Scope, leave the Username and Password fields empty. If you're using a single tenant app, configure the Tenant field. If you're using a multitenant app (the UiPath public app is multitenant), you can leave the Tenant field empty.

Scopes for Interactive token

When you add an activity to Microsoft 365 Scope, its required scopes are automatically detected. You can also choose to allow additional scopes or fewer scopes. If fewer scopes are selected, some activity functionalities might not work. For more information, see Working with activity scopes.


docs image

UiPath Public App registration

The UiPath Public App is registered with the following information:

  • Name: UiPathStudioO365App
  • Client ID: f2f43f65-16a6-4319-91b6-d2a342a88744
  • Scopes: Calendars.Read, Calendars.Read.Shared, Calendars.ReadWrite, Calendars.ReadWrite.Shared, Chat.ReadWrite, email, EWS.AccessAsUser.All, Files.Read, Files.Read.All, Files.ReadWrite, Files.ReadWrite.All, Group.Read.All, Group.ReadWrite.All, Mail.Read, Mail.Read.Shared, Mail.ReadWrite, Mail.ReadWrite.Shared, Mail.Send, Mail.Send.Shared, offline_access, openid, Presence.Read, Presence.Read.All, profile, Sites.Read.All, Sites.ReadWrite.All, User.Read, User.Read.All.

How to create an application for Microsoft 365 Scope connections

To enable the Microsoft 365 classic activities, your app must be integrated with the Microsoft identity platform and have the correct Microsoft Graph API permissions assigned to it.

要集成应用程序、分配权限并开始构建自动化项目,请完成以下步骤:

  1. 注册您的应用程序。
  2. 添加 API 权限。
  3. 构建项目。

注册 Microsoft 365 应用程序后,Azure Active Directory 会分配您在Microsoft 365 作用域活动中输入的唯一应用程序(客户端)ID,以及您分配权限的服务(例如,文件、邮件、日历)。



注册您的应用程序

提示:快速入门:向 Microsoft 身份平台注册应用程序中的 Microsoft 文档详细介绍了此流程。请注意,自首次记录这些步骤以来,Microsoft 用户界面可能已发生变化。
  1. 使用您的个人、工作或学校 Microsoft 365 帐户登录 Azure 门户
  2. 在左侧导航面板中,单击“ Azure Active Directory”。
  3. Azure Active Directory 页面打开后,单击“ 应用程序注册” 。
  4. 单击顶部导航栏中的“ + 新注册 ”。

  5. 输入应用程序的 名称 (例如,“Office365App”)。
  6. 在“支持的帐户类型”下,选择适用于您的选项。有关选择何种选项的更多信息,请参阅谁可以登录您的应用程序?

    • 仅限此组织目录中的帐户 - 如果您的目标受众是组织内部的帐户,请使用此选项。这表示单租户应用程序。
    • 任何组织目录中的帐户(任何 Azure AD 目录 - 多租户)- 如果您的目标受众是企业或教育客户,请使用此选项。这表示多租户应用程序。
    • 任何组织目录中的帐户和 Microsoft 个人帐户(例如 Skype, Xbox)- 使用此选项定位最广泛的 Microsoft 身份。这表示多租户应用程序。
  7. 在“重定向 URI(可选)”下,输入 URI 地址(如果适用)。Microsoft 身份验证库 (MSAL.NET) 使用默认重定向 URI:https://login.microsoftonline.com/common/oauth2/nativeclient。使用“交互式令牌”身份验证类型时,此值可能适用。
    • 您的选择取决于您的身份验证类型。有关此主题的更多信息,请参阅如何连接到 Microsoft 365 活动
    • 在我们的示例中,组织支持多租户身份验证,并且只能使用需要重定向 URI 的“交互式令牌”身份验证类型。
      • 如果您使用交互式令牌和默认的 Microsoft 重定向 URI,则必须添加类型为“移动和桌面应用程序”的平台。有关更多信息,请参阅 Microsoft 文档中的配置平台设置
      • 如果您的身份验证类型为“集成 Windows 身份验证”“用户名和密码”,则无需为应用程序注册重定向 URI。这些流程会往返于 Microsoft 身份平台 v2.0 端点,并且您的应用程序不会在任何特定 URI 上回调。
    • 在面向 .NET 5.0 的 UiPath Studio 项目中使用 Microsoft 365 时,将 http://localhost 添加到自定义应用程序的重定向 URI 中。

      有关详细信息,请参阅 Microsoft 标识平台文档中的 桌面应用程序注册

  8. 选择“注册”。下图提供了示例配置。
    注意: 此设置只是一个示例。 请按照文档中所述的步骤操作,并根据组织的策略进行选择。


操作完毕! 现在,我们向已注册的应用程序添加 API 权限。

添加 API 权限

  1. 在已注册的应用程序页面( Azure 门户 > Azure Active Directory > 应用注册 > Office365App )中,在左侧导航面板中选择“ API 权限”。
  2. “API 权限”页面打开后,单击“ + 添加权限 ”(这将打开“ 请求 API 权限 ”窗口)。
  3. 在“ 选择 API” 下,单击“ Microsoft API ”(默认情况下可能处于打开状态)。
  4. 在“ 常用 Microsoft API”下,单击“ Microsoft Graph”。

  5. 在“您的应用程序需要什么类型的权限?”下,单击“委派权限”或“应用程序权限”以显示权限列表。如果使用“应用程序 ID 和密码”或“应用程序 ID 和证书”身份验证类型,请选择“应用程序权限”。“Microsoft 365 作用域”活动中可用的其他身份验证类型需要“委派权限”。

    有关权限类型的更多信息,请参阅 Microsoft Azure 文档中的 配置客户端应用程序以访问 Web API

  6. 使用搜索栏或向下滚动按字母顺序排列的列表,然后选择以下权限:
    注意:这些权限并不都是必需的。提供的列表表示运行所有 Microsoft 365 活动所需的完整权限集。您可以根据特定用例限制权限。查看活动文档页面,了解其需要哪些权限。
    • 日历

      • 日历. 读取
      • Calendars.ReadWrite
    • 文件

      • 文件。读取
      • 文件读取全部
      • Files.ReadWrite
      • Files.ReadWrite.All
    • 网站

      • 站点。只读。全部
      • Sites.ReadWrite.All
    • 邮件

      • 邮件读取
      • 邮件读写
      • 邮件.发送
    • 用户
      • User.Read
    • 共享(访问与用户共享但并非用户所有的资源所需的作用域。)

      • 邮件读取共享
      • 邮件读写共享
      • 邮件.发送.共享
      • Calendars.Read.Shared
      • Calendars.ReadWrite.Shared
    • 选择“添加权限”以返回到 API 权限列表。



  7. 确保您的 API 权限包括您添加的“日历”、“文件”、“用户”和“邮件”权限。



在桌面版 Studio 中构建项目

  1. 创建一个新的自动化项目。

    1. 打开 UiPath Studio

    2. 在“新建项目”下,单击“流程”。这将打开一个“新建空白流程”窗口。

    3. 输入项目 名称位置说明

    4. 选择“ 兼容性”。 默认情况下选择“Windows”。

    5. 单击“创建”。

  2. 安装 UiPath.MicrosoftOffice365.Activities 包。

    1. 从“设计”功能区中,选择“管理包”。
    2. 在“ 所有包”下的“ 搜索” 栏中,输入 Office 365Microsoft
    3. 选择所需的包版本,然后选择“安装”。
    4. 单击保存按钮。
    有关 UiPath Studio 包的更多信息,请参阅 Studio 指南中的 管理包

操作完毕!现在,您已完成设置,可以开始将 Microsoft 365 活动添加到项目中。

后续步骤

如需动手学习体验并快速开始使用这些活动,请参阅 快速入门 指南。 这些指南提供分步说明,以帮助您创建不同活动的工作示例,以便您可以验证与已注册应用程序的连接并熟悉输入/输出属性。

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

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo White
信任与安全
© 2005-2024 UiPath。保留所有权利。