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:
- Log in to Microsoft Entra admin center (https://entra.microsoft.com) (Ensure you're signed in as an admin).
- Navigate to App Registrations:
- Click on Identity in the sidebar
- Select Applications > App registrations
- Create New Registration:
- Click + New registration
- Enter a display Name for your application
- Select Supported account types (typically "Accounts in this organizational directory only")
- Click Register
- Note Application Credentials:
- From the Overview page, copy the Application (client) ID
- Copy the Directory (tenant) ID
- Create Client Secret:
- Navigate to Certificates & secrets
- Click + New client secret
- Enter a description and select expiry period
- Click Add and immediately copy the Value (displayed only once)
- Configure API Permissions:
- Navigate to API permissions
- Click + Add a permission
- Select Microsoft Graph
- Choose Application permissions for client credentials flow
- 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)
- Click Grant admin consent for your organization
Add connection
Here is how to add a connection on Leena AI:
- Log in to your Leena AI workspace
- Navigate to Settings > Integrations
- Search for "SharePoint" and select it from the list to add its new connector
- Select Authentication Type:
- OAuth 2.0 Client Credentials: For application-only access
- OAuth 2.0 Resource Owner Password Credentials: For delegated access
- Configure the connector based on selected authentication type:
OAuth 2.0 Client Credentials
- Tenant ID: Your Microsoft Entra Directory (tenant) ID
- Client ID: OAuth application client ID from App registration
- Client Secret: OAuth application client secret
- Scope: API permissions scope (Pre-filled with 'https://graph.microsoft.com/.default')
OAuth 2.0 Resource Owner Password Credentials
-
Tenant ID: Your Microsoft Entra Directory (tenant) ID
-
Client ID: OAuth application client ID from App registration
-
Client Secret: OAuth application client secret
-
Username: User account email address
-
Password: User account password
-
Scope: API permissions scope (Pre-filled with 'https://graph.microsoft.com/.default')
-
Save Configuration:
- Click Connect in Leena AI for SharePoint connector setup
- The connector will validate credentials with Microsoft Entra ID
- 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
| Name | Description |
|---|---|
| Title | The display title of the new site |
| Share By Email Enabled | Controls whether members can share files and folders via email (Boolean) |
| Classification | The governance classification for the site (e.g., 'HBI', 'LBI', 'Confidential') |
| Description | A description of the site's purpose |
| Web Template | The template to use for the site |
| Owner | The primary owner of the site (email address) |
| Web Template Extension ID | A GUID representing a custom site template extension |
Optional
| Name | Description |
|---|---|
| URL | The desired URL path. If not provided, it's auto-generated from the Title |
| Lcid | The 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
| Name | Description |
|---|---|
| Target Type | The type of target entity (sites, users, or groups) |
| Target ID | The unique identifier of the target entity |
Optional
| Name | Description |
|---|---|
| Expand Properties | Retrieves related resources |
| Select Properties | Filters properties (columns) to return |
| Skip Token | Retrieves the next page of results from result sets that span multiple pages |
| Top | Limits the number of items returned |
| Order By | Orders 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
| Name | Description |
|---|---|
| Drive ID | The unique identifier of the drive |
Optional
| Name | Description |
|---|---|
| Select Properties | Filters 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
| Name | Description |
|---|---|
| Target Type | The type of target entity (drives, sites, groups, or users) |
| Target ID | The unique identifier of the target entity |
| Item ID | The 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
| Name | Description |
|---|---|
| Target Type | The type of target entity (drives, sites, groups, or users) |
| Target ID | The unique identifier of the target entity |
| Search Query | The search keywords to find items |
Optional
| Name | Description |
|---|---|
| Expand Properties | Retrieves related resources |
| Select Properties | Filters properties (columns) to return |
| Skip Token | Retrieves the next page of results from result sets that span multiple pages |
| Top | Sets the page size of results |
| Order By | Orders 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
| Name | Description |
|---|---|
| Target Type | The type of target entity (sites, users, or groups) |
| Target ID | The unique identifier of the target entity |
Optional
| Name | Description |
|---|---|
| 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 Properties | Retrieves related resources |
| Select Properties | Filters properties (columns) to return |
| Top | Sets the page size of results |
| Exclude Parent Items | Include 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
Updated 1 day ago
