Confluence configuration test fails with http error 500

After configuring the configuration for the SharePoint Connector in Confluence, a 500 error is displayed in the Configuration Test Results at "Search Sites", "Search Lists" or "Search Documents":

Search Sites request failed. Check your SharePoint URL. 500 error



This problem could occur for SharePoint Online and SharePoint on-premise as well (For on-premise the screenshot looks a bit different).

Usual Causes

  1. The logged in user to SharePoint does not have at least read access to the SharePoint site collection in order to perform search queries on the SharePoint List macro configuration.

    1. Can receive the following error that can be seen in the postquery when analyzing the network calls.



      {"error":{"code":"-1, Microsoft.Office.Server.Search.REST.SearchServiceException","message":{"lang":"en-US","value":"The SafeQueryPropertiesTemplateUrl \"The SafeQueryPropertiesTemplateUrl "{0}" is not a valid URL.\" is not a valid URL."}}}



  2. Grant admin consent was not performed when configuring API permissions in Azure. See the documentation here for more info.

    1. The following errors can be seen in the postquery when analyzing the network calls.

      "error":{"code":"-1, Microsoft.Office.Server.Search.REST.SearchServiceException","message": {"lang":"en-US","value":"The current principal does not have permission to execute queries on behalf of other users."}



Further Investigation

For an investigation please provide our support with the following information:

  1. A HAR file from the time you executed the check in Confluence. For an instruction see Generating HAR files and Analysing Web Requests

  2. Execute the query according to the Query Table for "Search Sites", "Search Lists" or "Search Documents" using the free Search Query Tool.

    1. Instruction: Executing a search query using SharePoint Search Query Tool

    2. Be sure you use the same SharePoint Account (Online or 2016) you used in the browser before

    3. Attach screenshots from the status and the primary results tab.

Query Table

For

Query

For

Query

Search Sites

  • (contentclass:STS_web OR contentclass:STS_site)

Search Lists

  • contentclass=STS_List_* AND (Title:* OR Filename:*)

  • (contentclass:STS_List_* OR contentclass:STS_View) AND (Title:* OR Filename:*)

Search Documents

  • IsDocument="true" AND (Title:* OR Filename:*)