Microsoft Search Message
About
Microsoft Search Message backend uses the Graph APIto:
- Send search queries to Microsoft 365
- Search for information in email messages (body and attachments)
- Receive emails from user's own mailbox
Set Azure Active Directory Authentication
Set authentication to Azure Active Directory in SmartHub as described here: Azure Active Directory Authentication.
Client ID Requirements
The Client ID specified in Azure Active Directory Authentication above, must belong to an application with the following permissions, set in Azure:
- Azure Active Directory Graph
- User.Read
- Microsoft Graph
- Files.Read
- Files.Read.All
- Mail.Read
- Mail.ReadWrite
How to Add the Microsoft Search Message Backend to SmartHub
Use the following instructions to add the Microsoft Search Message backend to SmartHub:
- Navigate to the SmartHub Administration page:http(s)://[web-app-url]/_admin
- Click Add New Backend.
- The backend dialogue box appears.
- Enter a backend name.
- Select the backend type "MSSearchMessageBackend"
- Authentication
- Impersonate - true
- Security trims the results using the current user running the search
- Impersonate - false
- Client Id:
- Enter the Application ID from Azure App Registrations.
- Client Secret:
- Enter the Key's value from Azure App Registrations.
- Microsoft Login Endpoint:
- Example: https://login.microsoftonline.com
- Access Token:
- Enter the access token from SmartHub's OAuth page.
-
Refresh Token:
-
Enter the refresh token from SmartHub's OAuth page.
In order to get AccessToken and Refresh token, "Authorize" button must be clicked, but it needs all above fields to be completed (GraphUrl, ClientId, ClientSecret, MicrosoftLoginEndpoint).
-
- Client Id:
- Impersonate - true
- Click OK.
How to Register an App in Azure and Configure It
If you use SmartHub with Azure Active Directory authentication you can reuse the same App and jump to step 5.
- Navigate to portal.azure.com and log in.
- From the left side menu go to Azure Active Directory → App registrations → New registration
- Name: Enter the name of the application.
- Application type: Select Web app / API.
- Sign-on URL: Enter the SmartHub's URL.

- Select API Permissionsto open the settings menu panel.
- Click Add a Permission.
- Select APIs my organization uses and add the following permissions (as you type the name, it appears):
- Azure Active Directory Graph
- User.Read
- Microsoft Graph
- Calendars.Read.All
- Files.Read.All
- Files.ReadWrite.All
- Sites.Read.All
- Sites.ReadWrite.All

- Azure Active Directory Graph
- Click Certificates & secrets>New client secret to generate a client secret key.
- In the window that appears (shown below) enter the following information.
- Description:Enter a name for the client secret. (Note: The name is your client secret).
- Expires: Select the period until expires.

- A Value is generated after you clickAdd.

Metadata
Metadata Info
In order to use the properties received from Microsoft Graph, properties are flattened.
BA Insight does this because Microsoft Graph API returns properties in this format:
Example:
"sender":{"emailAddress":{"name":"ExampleName","address":"no-reply@examplename.com"}}}}
In this case, if you want to use property address, you need to add this property in SmartHub: sender.emailAddress.address
-
Microsoft called this properties "Recipient".
-
In case that the property from Microsoft Graph API returns a collection of "Recipient", in SH values for the specific property will be returned as string with ";" used as a delimiter.
-
The format for Recipient collection must be the same as above.
-
Recipient format is:
propertyName.emailAddress.name / propertyName.emailAddress.address
Here you can find all properties from Microsoft Graph : https://docs.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0
The following metadata is available for your results:
- @data.type
- summary
- rank
- bccRecipients.emailAddress.address
- bccRecipients.emailAddress.name
- body.content
- body.contentType
- bodyPreview
- categories
- ccRecipients.emailAddress.address
- ccRecipients.emailAddress.name
- changeKey
- conversationId
- conversationIndex
- createdDateTime
- flag
- from.emailAddress.address
- from.emailAddress.name
- hasAttachments
- id
- importance
- inferenceClassification
- internetMessageId
- isDeliveryReceiptRequested
- isDraft
- isRead
- isReadReceiptRequested
- lastModifiedDateTime
- parentFolderId
- receivedDateTime
- replyTo.emailAddress.address
- replyTo.emailAddress.name
- sender.emailAddress.address
- sender.emailAddress.name
- sentDateTime
- subject
- toRecipients.emailAddress.address
- toRecipients.emailAddress.name
- webLink
Limitations
Refiners are not supported by the Microsoft Search Message Backend