TaxCatchAll not being set in some cases

asked 2021-11-06T18:00:15.47+00:00
Wayne Kohler 1 Reputation point

First of all a quick disclaimer:
I am new to the SharePoint API and the concept of managed metadata term sets, so please bear with me.

I am supporting an application (VueJS/javascript) that searches a SharePoint 2016 Server instance for documents that are categorized by Managed Metadata Set tags. The application relies on the values of these tags being setting in the hidden TaxCatchAll field, but for some reason, TaxCatchAll is not getting set upon uploading a new file into the document library. The metadata must be present, because the files are displayed as being properly categorized in the library folder listing. In some cases, checking the file out and immediately checking it back in seems to trigger an update of TaxCatchAll, but in other cases, it does not.

Here is a sample of the type of API query that the application is running:

https://XXX.YYY.ZZZ/AAA/BBB/\_api/Web/GetFolderByServerRelativeUrl('IDTEST')/Files?$select=UIVersionLabel,TimeLastModified,ServerRelativeUrl,LinkingUrl,Name,UniqueId,Properties/TaxCatchAll,ListItemAllFields/OData\_\_dlc_DocId,Versions&$expand=Properties,ListItemAllFields,Versions

In most cases, the JSON returned from the API query contains the correct TaxCatchAll tag string, e.g.

"Properties": {
"__metadata": {
"id": "https://XXX.YYY.ZZZ/AAA/BBB/_api/Web/GetFileByServerRelativeUrl('/AAA/BBB/IDTEST/REDACTED')/Properties",
"uri": "https://XXX.YYY.ZZZ/AAA/BBB/_api/Web/GetFileByServerRelativeUrl('/BBB/BBB/IDTEST/REDACTED')/Properties",
"type": "SP.PropertyValues"
},
"TaxCatchAll": "3;#Design|a33c28b5-9744-49cd-8b13-63199c342ea5;#2;#ProjNameRedacted|3b51ca68-2135-4e16-a7a0-6d5460d8ef16;#31;#Archives|0d24179e-34f0-4d3c-9392-822614829dd8"
},

However, in some cases, it returns:

"Properties": {
"__metadata": {
"id": "https://XXX.YYY.ZZZ/AAA/BBB/_api/Web/GetFileByServerRelativeUrl('/AAA/BBB/IDTEST/REDACTED')/Properties",
"uri": "https://XXX.YYY.ZZZ/AAA/BBB/_api/Web/GetFileByServerRelativeUrl('/BBB/BBB/IDTEST/REDACTED')/Properties",
"type": "SP.PropertyValues"
},
"TaxCatchAll": "13;#;#3;#;#2;#;#8;#"
},

The tags are coming from a hierarchical managed term set structured similar to the following (Actual names changed)

"TopTermCategory"
"Document Type"
"TermVal1"
"TermVal2"
...

Is there perhaps a different API query I can use to find documents with a specific managed metadata term value instead of relying on TaxCatchAll?

I am desperate to find a solution. This has been hindering progress for several weeks now.

Thanks in advance to anyone that can offer help or suggestions.

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
1,662 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2021-11-08T08:02:03.633+00:00
    RaytheonXie_MSFT 14,226 Reputation points Microsoft Employee

    Hi @Wayne Kohler ,
    Please try following endpoint to retrieve TaxCatchAll:

    https://XXX.YYY.ZZZ/AAA/BBB/api/Web/GetFolderByServerRelativeUrl('IDTEST')/Files?$select=TaxCatchAll/ID,TaxCatchAll/Term&$expand=TaxCatchAll  
    

    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.