Search Microsoft 365 content from Sofi
Let Sofi's assistants search SharePoint, OneDrive and Microsoft 365 connectors as the signed-in user, with that user's permissions.
Set this up when you want Sofi’s assistants to answer from SharePoint, OneDrive for Business and Microsoft 365 connector content. Searches use the Microsoft Graph Copilot Retrieval API with each user’s own delegated token, so users only find what they can already open in Microsoft 365.
Before you begin
- You need the
administratorrole in Servicely, and rights to register applications and grant admin consent in Microsoft Entra ID. - Users need Microsoft 365 Copilot licences. The Copilot Retrieval API requires them.
- Users should sign in to Servicely through Microsoft Entra ID single sign-on, so their tokens are captured at sign-in.
Steps
-
In the Azure portal, open Microsoft Entra ID → App registrations and select or create the registration for Servicely.
-
Under API permissions, add these delegated permissions and grant admin consent:
Files.Read.All,Sites.Read.All,offline_access, andExternalItem.Read.Allif you search connector content. -
Under Authentication, add the redirect URI
https://<instance>.servicely.ai/sso/oauth_callback. It must match the Redirect URL field in the next step exactly. Under Certificates & secrets, note the client ID and create a client secret. -
In Servicely, in the Administration workspace, go to Integrations → API access → System OAuth providers and select New. Fill in the record as the table shows, and save.
Field Value Name A name you will reference later, for example ms-graph-copilotClient ID The application (client) ID of the registration Client Secret The client secret Authorization URL https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorizeToken URL https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/tokenRedirect URL https://<instance>.servicely.ai/sso/oauth_callbackScopes https://graph.microsoft.com/.default, which is also used when the field is emptyGrant type Authorization Code 
The System OAuth providers item in the Integrations menu. 
The empty Create System OAuth Provider form, with Client ID, Client Secret, Grant type and the URL fields. -
Go to Access & security → Authentication → Identity provider and open your Microsoft Entra ID provider. Add the new OAuth provider to OAuth Providers and save. Servicely now stores each user’s Microsoft tokens when they sign in.
-
Set the application property
microsoft.search.oauth.provider.nameto the Name of the OAuth provider. -
Give the assistants that should search Microsoft 365 a tool that uses it, such as (Knowledge) Search SharePoint/CoPilot (Self-Service). The shipped Self-Service Assistant already has it, once AI Self-Service is installed. AI Knowledge Management ships its own (Knowledge) Search SharePoint/CoPilot tool.
Result
When a user signs in through Microsoft Entra ID, Servicely saves their access and refresh tokens as a System API outbound token linked to the user and the OAuth provider. Tokens refresh automatically when they expire.
When an assistant searches, Servicely queries SharePoint, OneDrive for Business and connector items in one batched call. It returns the five most relevant extracts to the assistant by default. A source that returns an error, for example because the user has no access, is skipped and the other results are still returned. A user with no stored token sees a “Connect your Microsoft account” link that starts the Microsoft consent flow.
Tokens are stored encrypted, and the search never uses application-only credentials.