SharePoint Multilingual - Rest API filters are always querying with English values for Terms (MANAGED METADATA) though user is a FRENCH user

2024-10-18T12:35:02.1766667+00:00

Rest API filters are always querying with English values for Terms (MANAGED METADATA) though user is a FRENCH user. I have the below query that is not working and unable to get results.

Rest API (Not working for French user): https://mytenant.sharepoint.com/sites/mysite/_api/web/lists/getByTitle('Site Pages')/items?$filter=(StartDateTime le datetime'2024-10-18T02:54:09.168Z' and EndDateTime ge datetime'2024-10-18T02:54:09.168Z' and ContentType eq 'News' and OData__ModerationStatus ne 3 and (TaxCatchAll/IdForTerm eq '----****') and (TaxCatchAll/Term eq 'Litige et résolution de conflits')) and FileDirRef eq '/sites/mysite/SitePages/fr'&$select=ID,Title,Summary,NewsAuthor/Id,NewsAuthor/Title,NewsAuthor/UserName,NewsAuthor/FirstName,NewsAuthor/LastName,RelatedPeople/Id,RelatedPeople/Title,RelatedPeople/UserName,Featured,StartDateTime,EndDateTime,EncodedAbsUrl,NewsTypes,TaxCatchAll,TaxCatchAll/Term,TaxCatchAll/Id,TaxCatchAll/IdForTerm,BannerImageUrl&$expand=NewsAuthor,RelatedPeople,TaxCatchAll,TaxCatchAll/Term,TaxCatchAll/Id,TaxCatchAll/IdForTerm

Rest API (Working for French user): https://mytenant.sharepoint.com/sites/mysite/_api/web/lists/getByTitle('Site Pages')/items?$filter=(StartDateTime le datetime'2024-10-18T02:54:09.168Z' and EndDateTime ge datetime'2024-10-18T02:54:09.168Z' and ContentType eq 'News' and OData__ModerationStatus ne 3 and TaxCatchAll/Term ne 'Client Success Stories' and (TaxCatchAll/IdForTerm eq '----****') and (TaxCatchAll/Term eq 'Litigation and Dispute Resolution')) and FileDirRef eq '/sites/mysite/SitePages/fr'&$orderby=StartDateTime desc&$top=50&$select=ID,Title,Summary,NewsAuthor/Id,NewsAuthor/Title,NewsAuthor/UserName,NewsAuthor/FirstName,NewsAuthor/LastName,RelatedPeople/Id,RelatedPeople/Title,RelatedPeople/UserName,Featured,StartDateTime,EndDateTime,EncodedAbsUrl,NewsTypes,TaxCatchAll,TaxCatchAll/Term,TaxCatchAll/Id,TaxCatchAll/IdForTerm,BannerImageUrl&$expand=NewsAuthor,RelatedPeople,TaxCatchAll,TaxCatchAll/Term,TaxCatchAll/Id,TaxCatchAll/IdForTerm

Not sure why this is happening. This used work as expected few days ago.

Microsoft 365 and Office | SharePoint | Development
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,836 Reputation points Microsoft External Staff
    2024-10-21T08:28:33.03+00:00

    From the information you provided, it appears that the Rest API is not working for French users when the term is in French (Litige et résolution de conflits), but it works when the term is in English (Litigation and Dispute Resolution).

    Rest API is language-independent, particularly when dealing with lists and libraries.  Everything works fine when the site is in English and the user's language is English, but many things don't work like the example when the Rest API encounters a different language. 

    You need to encode your query component with a different language. You could use any online tool to encode.

    Reference:

    https://blog.icefire.ca/blogs/post/how-to-make-sharepoint-api-calls-language-independent

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.