SharePoint

Overview

The SharePoint connector enables your AI Colleagues to integrate with your organization's Microsoft SharePoint platform, facilitating automated document management, site provisioning, content discovery, and file management workflows.

SharePoint is Microsoft's collaborative platform that allows organizations to create websites, store and share documents, and manage content across teams. The SharePoint connector allows Leena AI to automate document workflows, manage sites, discover and search content, and interact with SharePoint drives seamlessly.

API Details

Leena AI integrates with SharePoint via Microsoft Graph API and SharePoint REST API.

Documentation link: https://learn.microsoft.com/en-us/graph/api/resources/sharepoint

Setup

The SharePoint connector supports two OAuth 2.0 authentication methods:

  • OAuth 2.0 Client Credentials: For application-only access without user interaction
  • OAuth 2.0 Resource Owner Password Credentials: For delegated access with user credentials

Prerequisites

Before setting up the SharePoint connector, ensure you have:

  • Administrator access to Microsoft Entra admin center (Azure AD)
  • Access to Microsoft Entra ID App registrations
  • Ability to create and configure OAuth applications in Microsoft Entra ID
  • Permissions to grant admin consent for Microsoft Graph API permissions
  • Access to your Leena AI workspace with connector management permissions

Get credentials

Here is how to create an OAuth application in Microsoft Entra admin center:

  1. Log in to Microsoft Entra admin center (https://entra.microsoft.com) (Ensure you're signed in as an admin).
  2. Navigate to App Registrations:
    1. Click on Identity in the sidebar
    2. Select Applications > App registrations
  3. Create New Registration:
    1. Click + New registration
    2. Enter a display Name for your application
    3. Select Supported account types (typically "Accounts in this organizational directory only")
    4. Click Register
  4. Note Application Credentials:
    1. From the Overview page, copy the Application (client) ID
    2. Copy the Directory (tenant) ID
  5. Create Client Secret:
    1. Navigate to Certificates & secrets
    2. Click + New client secret
    3. Enter a description and select expiry period
    4. Click Add and immediately copy the Value (displayed only once)
  6. Configure API Permissions:
    1. Navigate to API permissions
    2. Click + Add a permission
    3. Select Microsoft Graph
    4. Choose Application permissions for client credentials flow
    5. Add required permissions:
      • Sites.Read.All (for reading sites and drives)
      • Sites.ReadWrite.All (for creating sites and managing content)
      • Files.Read.All (for reading files)
      • Files.ReadWrite.All (for managing files)
    6. Click Grant admin consent for your organization

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "SharePoint" and select it from the list to add its new connector
  4. Select Authentication Type:
    1. OAuth 2.0 Client Credentials: For application-only access
    2. OAuth 2.0 Resource Owner Password Credentials: For delegated access
  5. Configure the connector based on selected authentication type:

OAuth 2.0 Client Credentials

  1. Tenant ID: Your Microsoft Entra Directory (tenant) ID
  2. Client ID: OAuth application client ID from App registration
  3. Client Secret: OAuth application client secret
  4. Scope: API permissions scope (Pre-filled with 'https://graph.microsoft.com/.default')

OAuth 2.0 Resource Owner Password Credentials

  1. Tenant ID: Your Microsoft Entra Directory (tenant) ID

  2. Client ID: OAuth application client ID from App registration

  3. Client Secret: OAuth application client secret

  4. Username: User account email address

  5. Password: User account password

  6. Scope: API permissions scope (Pre-filled with 'https://graph.microsoft.com/.default')

  7. Save Configuration:

    1. Click Connect in Leena AI for SharePoint connector setup
    2. The connector will validate credentials with Microsoft Entra ID
    3. Upon successful validation, the connector will be saved

Actions

The following actions are supported for the SharePoint connector:

Create Site

Creates a new modern SharePoint site. The Agent can leverage the skill (workflow), which has been designed to create a new SharePoint site, once the user raises a query to do so. This action enables governed, template-based creation of modern SharePoint Communication and Team sites.


Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
TitleThe display title of the new site
Share By Email EnabledControls whether members can share files and folders via email (Boolean)
ClassificationThe governance classification for the site (e.g., 'HBI', 'LBI', 'Confidential')
DescriptionA description of the site's purpose
Web TemplateThe template to use for the site
OwnerThe primary owner of the site (email address)
Web Template Extension IDA GUID representing a custom site template extension

Optional

NameDescription
URLThe desired URL path. If not provided, it's auto-generated from the Title
LcidThe Locale Identifier (e.g., '1033' for English-US) to set the site's default language

Web Template Options:

  • SITEPAGEPUBLISHING#0: A modern Communication Site
  • STS#3: A modern Team Site not connected to a Microsoft 365 Group

Here is a sample JSON input:

{
  "request": {
    "Title": "Marketing Team Site",
    "Url": "https://contoso.sharepoint.com/sites/marketing-team",
    "ShareByEmailEnabled": true,
    "Classification": "Internal",
    "Description": "Collaboration site for the Marketing team",
    "WebTemplate": "SITEPAGEPUBLISHING#0",
    "Owner": "[email protected]",
    "WebTemplateExtensionId": "00000000-0000-0000-0000-000000000000",
    "Lcid": "1033"
  }
}

Response

Upon successful creation, the action returns the created site details including:

  • Site ID
  • Site URL
  • Creation status
  • Site properties

List Drive

Lists all available drives (document libraries) associated with a specific SharePoint entity such as a site, user, or Microsoft 365 group. This is the starting point for any file-based operation, allowing systems to identify the correct storage locations.


Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Target TypeThe type of target entity (sites, users, or groups)
Target IDThe unique identifier of the target entity

Optional

NameDescription
Expand PropertiesRetrieves related resources
Select PropertiesFilters properties (columns) to return
Skip TokenRetrieves the next page of results from result sets that span multiple pages
TopLimits the number of items returned
Order ByOrders results by specified property

Target Type Options:

  • sites: SharePoint sites
  • users: User's OneDrive
  • groups: Microsoft 365 Group drives

Here is a sample JSON input:

{
  "targetType": "sites",
  "targetId": "contoso.sharepoint.com,site-id-guid",
  "select": "id,name,webUrl",
  "top": "10",
  "orderby": "name"
}

Response

The action returns a list of drives, each containing:

  • Drive ID
  • Drive name
  • Web URL
  • Drive type
  • Owner information
  • Quota details

Get Drive

Retrieves the details of a single, specific drive by its unique ID. This action is useful when you need detailed information about a particular document library.


Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Drive IDThe unique identifier of the drive

Optional

NameDescription
Select PropertiesFilters properties (columns) to return

Here is a sample JSON input:

{
  "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
  "select": "id,name,webUrl,owner,quota"
}

Response

The action returns drive details including:

  • Drive ID
  • Drive name
  • Web URL
  • Drive type
  • Owner information
  • Quota information (used, remaining, total)

List children

Fetches the list of child items (files and folders) within a specified parent item (folder) in a drive. This action enables programmatic browsing through the drive's contents.


Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Target TypeThe type of target entity (drives, sites, groups, or users)
Target IDThe unique identifier of the target entity
Item IDThe unique identifier of the parent item (folder) to list

Target Type Options:

  • drives: Direct drive access
  • sites: SharePoint sites
  • groups: Microsoft 365 Group drives
  • users: User's OneDrive

Here is a sample JSON input:

{
  "targetType": "sites",
  "targetId": "contoso.sharepoint.com,site-id-guid",
  "itemId": "root"
}

Response

The action returns a list of child items, each containing:

  • Item ID
  • Item name
  • Item type (file or folder)
  • Size
  • Created/modified timestamps
  • Web URL
  • Download URL (for files)

Search

Performs a keyword search for items within the root of a drive associated with a specified target. This capability is essential for automation scenarios where a process needs to find a document based on its name or content without knowing its exact location.


Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Target TypeThe type of target entity (drives, sites, groups, or users)
Target IDThe unique identifier of the target entity
Search QueryThe search keywords to find items

Optional

NameDescription
Expand PropertiesRetrieves related resources
Select PropertiesFilters properties (columns) to return
Skip TokenRetrieves the next page of results from result sets that span multiple pages
TopSets the page size of results
Order ByOrders results by specified property

Target Type Options:

  • drives: Direct drive access
  • sites: SharePoint sites
  • groups: Microsoft 365 Group drives
  • users: User's OneDrive

Here is a sample JSON input:

{
  "targetType": "sites",
  "targetId": "contoso.sharepoint.com,site-id-guid",
  "searchQuery": "quarterly report",
  "select": "id,name,webUrl,size",
  "top": "25",
  "orderby": "lastModifiedDateTime desc"
}

Response

The action returns a list of matching items, each containing:

  • Item ID
  • Item name
  • Item type (file or folder)
  • Size
  • Web URL
  • Last modified timestamp
  • Search result ranking

List Changes

Retrieves a set of changes (creations, modifications, deletions) that have occurred in a drive. This action is often used for synchronization scenarios to track what has changed since the last sync.


Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Target TypeThe type of target entity (sites, users, or groups)
Target IDThe unique identifier of the target entity

Optional

NameDescription
Token (Optional)If unspecified, enumerates current state. If "latest", returns empty response with latest delta token. If a previous delta token, returns new state since that token.
Expand PropertiesRetrieves related resources
Select PropertiesFilters properties (columns) to return
TopSets the page size of results
Exclude Parent ItemsInclude only changed items, not parent items in the hierarchy (Boolean)

Target Type Options:

  • sites: SharePoint sites
  • users: User's OneDrive
  • groups: Microsoft 365 Group drives

Here is a sample JSON input:

//Initial sync (get current state)

{
  "targetType": "sites",
  "targetId": "contoso.sharepoint.com,site-id-guid",
  "top": "100"
}

//Get changes since last sync

{
  "targetType": "sites",
  "targetId": "contoso.sharepoint.com,site-id-guid",
  "token": "aTE9OTEwODc0OTAwMDAwMDAwMDAw...",
  "deltaExcludeParent": true
}

//Get latest token only

{
  "targetType": "sites",
  "targetId": "contoso.sharepoint.com,site-id-guid",
  "token": "latest"
}

Response

The action returns a list of changed items including:

  • Changed item details (ID, name, type)
  • Change type (created, modified, deleted)
  • Delta link for subsequent sync calls
  • Timestamps of changes