Skip to content

SharePoint Online Search REST API parameter sortlist is causing an error (again) #11043

Description

@mcgeeky

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint REST API

Developer environment

None

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

No response

Describe the bug / error

The SharePoint API endpoint _api/search is returning an error when using the sortlist parameter sortlist='[docid]:ascending'

The error returned is 400 BAD REQUEST with the message:

We didn't understand your search terms. Make sure they're using proper syntax

The full error code is:

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.Office.Server.Search.REST.SearchServiceException</m:code>
<m:message xml:lang="en-US">We didn't understand your search terms. Make sure they're using proper syntax.</m:message>
</m:error>

This appears to be the same error, or similar to, the one I reported in May 2024 which was subsequently fixed.

If this is a breaking change that has been deployed to SharePoint Online, we need the breaking change rollout stopped and then reverted before the impact spreads further to other tenants.

The sortlist parameter with [docid]=ascending is valid search syntax as per the Microsoft help article here. https://learn.microsoft.com/en-us/sharepoint/dev/general-development/pagination-for-large-result-sets

Steps to reproduce

Open Edge browser, sign in to your SharePoint site then copy and paste this URL in to the address bar and hit return, after changing YOURDOMAIN for your SharePoint tenant name:

https://YOURDOMAIN.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site+(WebTemplate:GROUP OR WebTemplate:TEAMCHANNEL)'&sortlist='[docid]:ascending'

You will receive an error message.

If the sortlist parameter is removed from the query then it will succeed:

https://YOURDOMAIN.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site+(WebTemplate:GROUP OR WebTemplate:TEAMCHANNEL)'

This will return an error on impacted tenants only. It appears to be affecting only a subset of tenants at present.

Expected behavior

The expected SharePoint search results should be returned, not an error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI-generated responsetype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions