SharePoint
Discover how to search and retrieve files from SharePoint using StackAI, including required inputs, configurations, and output details.
What is SharePoint?
SharePoint is a collaborative platform that enables organizations to share, manage, and access content, knowledge, and applications. With StackAI, you can automate file searches and integrate SharePoint data into your workflows.
How to use it?
The SharePoint node in StackAI allows you to search for files stored in your SharePoint environment. You can specify search queries, filter by file types, and control the number of results returned. This is ideal for automating document retrieval, content management, and knowledge discovery.
Example of Usage
Suppose you want to find all PDF reports related to "Quarterly Sales" in your SharePoint. You would set up the node as follows:
Input Example:
Search Query (string, required): "Quarterly Sales"
File Types (string array, optional): ["pdf"]
Max Results (integer, optional): 10
The node will return a list of matching files, including their names, URLs, types, modification dates, and more.
Setting Up A Connection
To use the the SharePoint node, you must connect your SharePoint account to Stack AI using OAuth2. This connection requires several key pieces of information, which are typically provided by your Microsoft Azure/SharePoint administrator:
1. Client ID (string, required)
What it is: A unique identifier for your Azure AD application (also called "Application (client) ID").
Where to find it: In the Azure portal, under "Azure Active Directory" > Under "Manage" select "App registrations" > [Your App] > "Overview".
Example:
b1a7c8e2-1234-4f56-9abc-1234567890ab
2. Client Secret (string, required)
What it is: A password-like value generated for your Azure AD application, used to authenticate your app.
Where to find it: In the Azure portal, under "Azure Active Directory" > "App registrations" > [Your App] > "Certificates & secrets". You must create a new client secret and copy the value.
Example:
wJ8Q~abc1234efgh5678ijklmnop9qrstuvwx
3. Tenant ID (string, required)
What it is: The unique identifier for your Microsoft 365 tenant (organization).
Where to find it: In the Azure portal, under "Azure Active Directory" > "Overview" > "Tenant ID".
Example:
72f988bf-86f1-41af-91ab-2d7cd011db47
4. SharePoint Site ID (string, optional)
What it is: The unique identifier for the SharePoint site you want to access. This is not the site URL, but an internal ID.
Where to find it: You can get this via the Microsoft Graph API or from your SharePoint admin. Sometimes, it is in the format:
contoso.sharepoint.com,12345678-90ab-cdef-1234-567890abcdef,abcdef12-3456-7890-abcd-ef1234567890
Example:
contoso.sharepoint.com,12345678-90ab-cdef-1234-567890abcdef,abcdef12-3456-7890-abcd-ef1234567890
Available Actions
1. Search Files
Search for files and documents in SharePoint using a query and optional filters.
Inputs
Search Query
The search string to find files and documents
"Quarterly Sales"
Yes
File Types
List of file types to filter by
["pdf", "docx"]
No
Max Results
Maximum number of results to return
10
No
Search Query (string, required): The keywords or phrase to search for in file names and content.
File Types (array of strings, optional): Filter results by file extensions (e.g., "pdf", "docx", "xlsx").
You can include any file extension that is supported by your SharePoint environment.
Common examples include:
"pdf"
(PDF documents)"docx"
(Word documents)"xlsx"
(Excel spreadsheets)"pptx"
(PowerPoint presentations)"txt"
(Text files)"csv"
(Comma-separated values)"jpg"
,"png"
,"gif"
(Image files)"zip"
(Compressed archives)...and any other file extension that your SharePoint instance stores
Max Results (integer, optional, default: 20): Limit the number of files returned.
Outputs
Each file in the output includes:
File ID (string): Unique identifier for the file.
File Name (string): Name of the file.
File URL (string): Direct link to access the file.
File Type (string): File extension/type (e.g., "pdf").
Modified Date (string): Last modified date.
Size (integer): File size in bytes.
Author (string): File author or creator.
Example Output:
{
"files": [
{
"file_id": "12345",
"file_name": "Quarterly_Report_Q1.pdf",
"file_url": "https://contoso.sharepoint.com/sites/finance/Shared%20Documents/Quarterly_Report_Q1.pdf",
"file_type": "pdf",
"modified_date": "2025-06-15T10:23:45Z",
"size": 1048576,
"author": "Jane Doe"
},
{
"file_id": "67890",
"file_name": "Budget_2025.pdf",
"file_url": "https://contoso.sharepoint.com/sites/finance/Shared%20Documents/Budget_2025.pdf",
"file_type": "pdf",
"modified_date": "2025-07-01T14:05:12Z",
"size": 2097152,
"author": "John Smith"
}
],
"total_count": 2
}
2. Search Files
This action creates a new Microsoft Word (DOCX) file in a specified SharePoint site and folder, with the content you provide (in Markdown format). Typically used to automate report generation, meeting notes, or any document creation directly into your SharePoint library.
Inputs
File Name
Name of the Word document to create (must end in .docx
).
Report.docx
Yes
Hostname
SharePoint site hostname (e.g., your company’s SharePoint domain).
contoso.sharepoint.com
No
Site Name
SharePoint site name (e.g., sites/YourSiteName
).
sites/Finance
No
Content
Document body text in Markdown format.
# Q2 Report\nSummary...
Yes
Folder Path
Destination folder path within the site. If omitted, saves to root folder.
/Shared Documents/Reports
No
Outputs
On success, the action returns:
File ID (string): Unique identifier of the created file.
File URL (string): URL to open the document in SharePoint/OneDrive.
Advanced Settings
Retry on Failure: Enable retrying when the node execution fails
Fallback Branch (integer): Create a separate branch that executed when this node fails, allowing you to handle errors gracefully
Summary Table
Search Files
Search for files in SharePoint
Search Query
File Types, Max Results
Files, Total Count
Create Word Document
Creates a word document in SharePoint
File Name, Content
Hostname, Site Name, Folder Path
File ID, File URL
Best Practices
Always provide a clear and specific search query for best results.
Use file type filters to narrow down results when searching for specific document formats.
Adjust the max results parameter to control the volume of data returned.
Last updated
Was this helpful?