使用 Azure 逻辑应用监视和管理 SharePoint 资源Monitor and manage SharePoint resources with Azure Logic Apps

使用 Azure 逻辑应用和 SharePoint 连接器可以创建自动化的任务和工作流,用于在 SharePoint Online 或本地 SharePoint 服务器中监视和管理文件、文件夹、列表、项、人员等资源,例如:With Azure Logic Apps and the SharePoint connector, you can create automated tasks and workflows that monitor and manage resources, such as files, folders, lists, items, persons, and so on, in SharePoint Online or in SharePoint Server on premises, for example:

  • 创建、更改或删除文件或项时进行监视。Monitor when files or items are created, changed, or deleted.
  • 创建、获取、更新或删除项。Create, get, update, or delete items.
  • 添加、获取或删除附件。Add, get, or delete attachments. 获取附件中的内容。Get the content from attachments.
  • 创建、复制、更新或删除文件。Create, copy, update, or delete files.
  • 更新文件属性。Update file properties. 获取文件的内容、元数据或属性。Get the content, metadata, or properties for a file.
  • 列出或提取文件夹。List or extract folders.
  • 获取列表或列表视图。Get lists or list views.
  • 设置内容审批状态。Set content approval status.
  • 解析人员。Resolve persons.
  • 将 HTTP 请求发送到 SharePoint。Send HTTP requests to SharePoint.
  • 获取实体值。Get entity values.

可以使用触发器从 SharePoint 获取响应,并使输出可用于其他操作。You can use triggers that get responses from SharePoint and make the output available to other actions. 可以使用逻辑应用中的操作在 SharePoint 中执行任务。You can use actions in your logic apps to perform tasks in SharePoint. 还可以让其他操作使用 SharePoint 操作的输出。You can also have other actions use the output from SharePoint actions. 例如,如果你定期从 SharePoint 提取文件,可以使用 Slack 连接器向团队发送消息。For example, if you regularly fetch files from SharePoint, you can send messages to your team by using the Slack connector. 如果你不熟悉逻辑应用,请查看什么是 Azure 逻辑应用?If you're new to logic apps, review What is Azure Logic Apps?

先决条件Prerequisites

  • Azure 订阅。An Azure subscription. 如果没有 Azure 订阅,请注册一个 Azure 试用帐户If you don't have an Azure subscription, sign up for a trial Azure account.

  • SharePoint 站点地址和用户凭据Your SharePoint site address and user credentials

    你的凭据授权逻辑应用创建连接并访问你的 SharePoint 帐户。Your credentials authorize your logic app to create a connection and access your SharePoint account.

  • 将逻辑应用连接到本地系统(例如 SharePoint 服务器)之前,需要安装并设置本地数据网关Before you can connect logic apps to on-premises systems such as SharePoint Server, you need to install and set up an on-premises data gateway. 这样,便可以指定在创建逻辑应用的 SharePoint 服务器连接时要使用网关安装。That way, you can specify to use your gateway installation when you create the SharePoint Server connection for your logic app.

  • 有关如何创建逻辑应用的基本知识Basic knowledge about how to create logic apps

  • 要在其中访问 SharePoint 帐户的逻辑应用。The logic app where you want to access your SharePoint account. 若要使用 SharePoint 触发器启动,请创建一个空白逻辑应用To start with a SharePoint trigger, create a blank logic app. 若要使用 SharePoint 操作,请使用触发器启动逻辑应用,例如,如果你有 Salesforce 帐户,则可使用 Salesforce 触发器。To use a SharePoint action, start your logic app with a trigger, such as a Salesforce trigger, if you have a Salesforce account.

    例如,可以使用“创建记录时”Salesforce 触发器来启动逻辑应用。For example, you can start your logic app with the When a record is created Salesforce trigger. 每当在 Salesforce 中创建新记录(例如潜在顾客)时,此触发器都会激发。This trigger fires each time that a new record, such as a lead, is created in Salesforce. 然后,可以使用 SharePoint 的“创建文件”操作来跟踪此触发器。You can then follow this trigger with the SharePoint Create file action. 这样,在创建新记录时,逻辑应用就会在 SharePoint 中创建一个包含有关该新记录的信息的文件。That way, when the new record is created, your logic app creates a file in SharePoint with information about that new record.

连接到 SharePointConnect to SharePoint

要使逻辑应用能够访问某个服务,必须在逻辑应用与该服务之间创建连接。Before your logic app can access any service, you must create a connection between your logic app and that service. 如果以前未创建此连接,则在向逻辑应用添加该服务的触发器或操作时,系统会提示输入连接信息。If you didn't previously create this connection, you're prompted for connection information when you add a trigger or action for that service to your logic app. 可以使用逻辑应用设计器轻松地直接从逻辑应用创建此连接。The Logic Apps Designer provides an easy way for you to create this connection directly from your logic app.

  1. 登录到 Azure 门户,在逻辑应用设计器中打开逻辑应用(如果尚未打开)。Sign in to the Azure portal, and open your logic app in Logic App Designer, if not open already.

  2. 对于空白逻辑应用,请在搜索框中输入“sharepoint”作为筛选器。For blank logic apps, in the search box, enter "sharepoint" as your filter. 在触发器列表下,选择所需的触发器。Under the triggers list, select the trigger you want.

    -或--or-

    对于现有逻辑应用,请在要添加 SharePoint 操作的最后一个步骤下,选择“新建步骤”。For existing logic apps, under the last step where you want to add a SharePoint action, choose New step. 在搜索框中,输入“sharepoint”作为筛选器。In the search box, enter "sharepoint" as your filter. 在操作列表下,选择所需的操作。Under the actions list, select the action you want.

    若要在步骤之间添加操作,请将鼠标指针移到步骤之间的箭头上。To add an action between steps, move your pointer over the arrow between steps. 选择出现的加号 ( + ),然后选择“添加操作”。Choose the plus sign (+) that appears, and then select Add an action.

  3. 系统提示登录时,请提供所需的连接信息。When you're prompted to sign in, provide the necessary connection information. 如果使用 SharePoint 服务器,请务必选择“通过本地数据网关连接”。If you're using SharePoint Server, make sure you select Connect via on-premises data gateway. 完成后,选择“创建”。When you're done, choose Create.

  4. 为所选触发器或操作提供所需的详细信息,然后继续生成逻辑应用的工作流。Provide the necessary details for your selected trigger or action and continue building your logic app's workflow.

连接器参考Connector reference

有关触发器、操作和限制(请参阅连接器的 OpenAPI(以前称为 Swagger)说明)的技术详细信息,请查看连接器的参考页For technical details about triggers, actions, and limits, which are described by the connector's OpenAPI (formerly Swagger) description, review the connector's reference page.

获取支持Get support

后续步骤Next steps