Skip to content

Tips, tricks and hints#

SharePoint Online#

  1. Document storage in SharePoint Online uses the standardized interface architecture of the Microsoft1 Graph API for connectivity. This can lead to differences in the connection compared to the SharePoint API.

  2. The search for keywords is always done with a set http header "prefer" with the value "HonorNonIndexedQueriesWarningMayFailRandomly" in order to be able to search over index terms that are not mapped in an index.

  3. Documents are always stored in SharePoint Online with conflict handling for renaming. As a result, a document of the same name, which is stored with identical index terms, never overwrites the existing document, but receives an automatically numbered, customized file name. This is done automatically using the URL parameter \@microsoft.graph.conflictBehavior=rename

Setting up app registrations#

In order to access SharePoint Online using OAuth 2.0 authentication using the Graph API, app registrations must be created that are designed for delegated access or application permissions. In the following chapters, a brief overview is given of which settings and procedures can be used for creating app registrations.

Set up an app registration for delegated access in Azure AD#

In order for users to authenticate to the Microsoft1 Graph API from within Business Central to use SharePoint access, an app registration for delegated access must be set up.

For details on how to set up an app registration, see the Microsoft1 documentation.

  1. Open the app registrations in Azure AD, create a new app registration, and give it a unique name.

  2. Under Authentication, specify the address https://businesscentral.dynamics.com/OAuthLanding.htm as a redirect -URI of type Web.

  3. Under "Certificates & Secrets", create a new client secret key and reserve it.
    Attention! After closing the pop-up window, this key can no longer be copied!

  4. Under "API Permissions" for SharePoint access, assign "Delegated permissions" to the Microsoft1 Graph scopes:

    • Files.ReadWrite.All
    • Sites.ReadWrite.All
    • User.Read.All

Set up app registration for application permissions in Azure AD#

If, for example, a service is to log on to SharePoint Online for background processing and store or query documents, it may be necessary to use SharePoint Online. Create an app registry with application permissions.

For details on how to set up an app registration, see the Microsoft1 documentation.

  1. Open the app registrations in Azure AD, create a new app registration, and give it a unique name.

  2. Under Authentication, specify the address https://businesscentral.dynamics.com/OAuthLanding.htm as a redirect -URI of type Web.

  3. Under "Certificates & Secrets", create a new client secret key and reserve it.
    Attention! After closing the pop-up window, this key can no longer be copied!

  4. Under "API Permissions" for SharePoint access, assign "Delegated permissions" to the Microsoft1 Graph scopes:

    • Files.ReadWrite.All
    • Sites.ReadWrite.All
    • User.Read.All

Crawled Properties vs. Managed Properties#

In the SharePoint structure, a basic distinction is made between "crawled properties" and "managed properties".

Crawled properties are created by adding new columns to a SharePoint list, for example. If necessary, an index can be placed on top of these columns, so that these columns can also be directly indexed and filtered. However, the disadvantage arises with regard to the Graph API as soon as an index term is used across lists in several thousand documents (e.g. the customer number). Here, the filtering mechanism of the Graph API can no longer perform structured filtering and accordingly returns an http error 422 "The request is unprocessable because it uses too many resources".

The "DMS & ECM Interface" offers the possibility to automatically switch to a search query (graph query) if there are too many hits and to obtain the documents via it. However, there are the following limitations that must be taken into account:

  • For a graph query, properties must be marked as "Refinable". This is only possible via the already supplied properties with the names "Refinable\\ (example "RefinableString00"! So, in order to make your own property searchable and make it available for return, managed, "refinable" properties must be mapped to the searchable properties. How to do this is explained in the next section.

  • Managed properties are not available until after indexing. Indexing in SharePoint Online is automated in a time cycle between 5 minutes and 2 hours and cannot be controlled by the user or administrator. As a result, it can happen that a document that has just been filed cannot yet be found via the search!

Assignment of "Refinable" properties#

Open the Microsoft1 365 admin center and select SharePoint under "Admin centers" in the left navigation tree.

In the "SharePoint admin center" in the left navigation tree, select "More features" and then select the "Open" button in the "Search" tile in the main area to open the search settings.

Then, on the following screen, select the "Manage Search Schema" list item.

Now, assign to the Managed Properties with the Refinable the individual crawled properties that you created from the columns of the Document Library.

Corresponding data types for the Refinable properties are:

  • RefinableDate (00-19)

  • RefinableDateFirst (00-04)

  • RefinableDateInvariant (00-01)

  • RefinableDateSingle (00-04)

  • RefinableDecimal (00-09)

  • RefinableDouble (00-09)

  • RefinableInt (00-49)

  • RefinableIntFirst (00-04)

  • RefinableString (00-219)

  • RefinableStringFirst (00-39)

  • RefinableStringLn (00-09)

  • RefinableStringWbOff (00-49)

  • RefinableStringWbOffFirst (00-49)

  • RefinableYesNo (00-04)

An overview of the various properties and their characteristics can be found in this link: Microsoft1 documentation


  1. Microsoft, Microsoft Dynamics, and Microsoft Dynamics 365 are trademarks of the Microsoft group of companies.