Create an automation with a SharePoint web trigger to send an email to theMicrosoft 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.
mentioned in the are met.

Procedure

  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: You can add a description for the bot in the Description field.
  5. Optional: You can use the Choose button to save the bot in a different folder.
  6. Click Create & Edit.
    The bot is created and the Edit Task Bot is displayed.
  7. Click Triggers > SharePoint, and then double-click or drag Web trigger to add the web trigger to Triggers section.
  8. Click Pick in the SharePoint OAuth and follow the prompts in Pick an OAuth connection to choose a preconfigured SharePoint OAuth connection.
  9. 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.
  10. Select File & Folder and perform the following: choose File created from the Listen to event drop-down.
    1. Select File created from the Listen to event drop-down.
    2. Enter the folder path in Folder path.
      Alternatively, click Select folder and follow the prompts in the Folders modal to choose the folder.
  11. Select SharePointTriggerData from the Response drop-down.
  12. Click Actions > Microsoft 365 Outlook, and then double-click or drag Connect to add the action to Actions section.
  13. Select Azure Global in Azure Cloud.
    If your Microsoft 365 Outlook is part of Microsoft 365 Government version, choose Azure US GCC High.
  14. Select Control Room managed in OAuth2 Authentication mode.
  15. Click Pick and follow the prompts in Pick an OAuth connection modal to chose the OAuth connection for Microsoft 365 Outlook.
  16. Click Variable > Insert a value and follow the prompts to choose the Microsoft 365 Outlook user name credential.
  17. Optional: Enter an appropriate session name in Create Microsoft 365 Outlook session.
    The system sets Microsoft365OutlookSession as the session name by default.
  18. Click Actions > Microsoft 365 Outlook, and then double-click or drag Send to add the action to Actions section.
  19. Optional: The default session name Microsoft365OutlookSession is auto populated in Microsoft 365 Outlook session.
  20. Enter the Microsoft 365 Outlook mail id to which the file details must be forwarded in To.
  21. Enter an appropriate subject line in Subject.
    The system sets Automation Anywhere finished executing the TaskBot as the subject line by default.
  22. 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.
When you click Run with triggers, the trigger starts to listen 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.