Docs
On this page
task2 min readApplication: SOFI Core

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 administrator role 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

  1. In the Azure portal, open Microsoft Entra ID → App registrations and select or create the registration for Servicely.

  2. Under API permissions, add these delegated permissions and grant admin consent: Files.Read.All, Sites.Read.All, offline_access, and ExternalItem.Read.All if you search connector content.

  3. Under Authentication, add the redirect URI https://<your-servicely-host>/sso/oauth_callback/. Under Certificates & secrets, note the client ID and create a client secret.

  4. In Servicely, go to Administration → Integration → 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-copilot
    Client ID The application (client) ID of the registration
    Client Secret The client secret
    Authorization URL https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize
    Token URL https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
    Redirect URL https://<your-servicely-host>/sso/oauth_callback
    Scopes https://graph.microsoft.com/.default, which is also used when the field is empty
    Grant type Authorization Code
  5. Go to Administration → 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.

  6. Set the application property microsoft.search.oauth.provider.name to the Name of the OAuth provider.

  7. 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.

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.

Last updated 18 October 2026commit c0e55f26ec7bChris Jones
Back to top