Configure SharePoint web trigger to trigger an action whenever an event occurs in a SharePoint site. This example shows how to create a Task Bot with a SharePoint web trigger to send an email to the Microsoft 365 Outlook mailbox when you add a file to the Documents folder in a SharePoint site.

Configure the SharePoint web trigger to monitor the SharePoint site folder ABC for a new file creation (File created event). The trigger listens for the File created event in the SharePoint site. When you add a file, the trigger activates the subsequent automation that sends the details of the file to the specified mailbox.

Prerequisites

Ensure that the following prerequisites are met:
  • Prerequisites mentioned in SharePoint web triggers.
  • Record variable named SharePointTriggerData.
  • Active OAuth connection for Microsoft 365 Outlook.
  • A credential variable that contains the Microsoft 365 Outlook user name.

Procedure

  1. Perform the following steps to create a Task Bot
    1. On the left pane, click Automation.
    2. Click Create > Task Bot.
      The Create Task Bot wizard is displayed.
    3. Enter an appropriate name for the bot in the Name field.
      All the bots are stored in <\Bots> folder by default.
    4. Optional: Add a description for the bot in the Description field.
    5. Optional: Click Choose and follow the prompts to save the bot in a different folder.
    6. Click Create & Edit.
      The bot is created and the Edit Task Bot is displayed.
  2. Perform the following steps to add and configure the SharePoint trigger.
    1. Click Triggers > SharePoint, and then double-click or drag Web trigger to add the web trigger to Triggers section.
    2. Click Pick in the SharePoint OAuth and follow the prompts in Pick an OAuth connection to choose a preconfigured SharePoint OAuth connection.
    3. Enter your SharePoint site in Site field in following format: https://{subdomain}.sharepoint.com/sites/{SiteName}.
      For example, if your site name is ABC that is located in XYZ SharePoint subdomain, enter https://xyz.sharepoint.com/sites/abc.
      Alternatively, click Select site and choose the site from the drop-down. The system uses OAuth connection to sync with SharePoint domain and lists all the sites that are available in the SharePoint domain.
    4. Select File & Folder in the Event type.
    5. Select File created from the Listen to event drop-down.
    6. Enter the folder path in Folder path.
      Alternatively, click Select folder and follow the prompts in the Folders modal to choose the folder.
    7. Select SharePointTriggerData from the Response drop-down.
  3. Perform the following steps to add and configure the Microsoft 365 Outlook Connect action.
    1. Click Actions > Microsoft 365 Outlook, and then double-click or drag Connect to add the action to Actions section.
    2. Select Azure Global in Azure Cloud.
      If your Microsoft 365 Outlook is part of Microsoft 365 Government version, choose Azure US GCC High.
    3. Select Control Room managed in OAuth2 Authentication mode.
    4. Click Pick and follow the prompts in Pick an OAuth connection modal to chose the OAuth connection for Microsoft 365 Outlook.
    5. Click Variable > Insert a value and follow the prompts to choose the Microsoft 365 Outlook user name credential.
    6. Optional: Enter an appropriate session name in Create Microsoft 365 Outlook session.
      The system sets Microsoft365OutlookSession as the session name by default.
  4. Perform the following steps to add and configure the Microsoft 365 Outlook Send action.
    1. Click Actions > Microsoft 365 Outlook, and then double-click or drag Send to add the action to Actions section.
    2. Enter the session name that you had entered when configuring the Connect action.
      If the default name is retained, the system prefills Microsoft365OutlookSession as the Microsoft 365 Outlook session.
    3. Enter the Microsoft 365 Outlook mail id to which the file details must be forwarded in To.
    4. Enter an appropriate subject line in Subject.
      The system sets Automation Anywhere finished executing the TaskBot as the subject line by default.
    5. Select HTML code in Email body type and enter the following:
      $SharePointTriggerData{"fields.LinkFilename"}$, SharePointTriggerData{"parentReference.path"}$, $SharePointTriggerData{"webUrl"}$
      where fields.LinkFilename provides the file name of the document, parentReference.path provides the file path where the file is located, and webUrl provides the direct link to the SharePoint location.
      For more information about trigger response data, see Reading trigger response data in Audit log.
  5. Click Save to save the configuration.
When you click Run > Run with triggers, the system activates the trigger and the trigger starts listening for the File created event in the folder ABC. When you create or upload a file, the trigger activates the subsequent Microsoft 365 Outlook actions. The Microsoft 365 Outlook mailbox receives an email containing the file name, folder path and a direct link to the file in comma separated values.