1

We use SharePoint Online. Created document library, synced to a local folder for initial file upload. Uploaded ~20k files. Created 3 custom fields (2 single value taxonomy, 1 multi value taxonomy). We manually set values for top level folders. And we needed to propagate same values for all files and folder under top ones.

Wrote node.js app which reads attributes from folder on top level, then writes same attributes to all nested files. All working fine, taxonomy fields got updated, even multi selection taxonomy. However these took a while to research in internet. All updates went without errors, except for few checked out files.

But we noticed, that approx 800 files and folders got updated partially. Some had only field3 updated, some field2 and field3, completely random. (However i shall say only 2 files didn't have their multi-taxonomy field updated.)

There is some pattern though - typically in one folder i see list of files and i see that custom field #1 missing , others two - properly set. In another folder i see field#1 and field#3 properly updated for most of files, but field#2 is empty.

I thought I missed some error and run the process again. Nothing changed. I tried to update one of those files via REST API - nothing happening. All is OK from API point of view, but fields not getting updated. When i read data back - its same as before update.

So now i stuck with 800 listitems@driveitems which refuse to be updated via REST API. How come? I can update fields manually from web UI, but any time i try to update them via REST API - it is just not updating. At same time i can easily update field values of files sitting next to those. Permissions look the same.

This is very weird behavior. How can i fix this?

Here is how I prepare POST body for fields#1 and #2

                    body['Region'] = {
                        "__metadata": {
                            "type": "SP.Taxonomy.TaxonomyFieldValue"
                        },
                        "TermGuid": parentAttr.Region.TermGuid,
                        "WssId": "-1"
                    };

Different schema for multi select taxonomy fields. I just keep comma separated guids and then create string like -1;#|;-1;#|;

body['md59817bf38f4370830b89bac6aa4e79'] = parentAttr.CommaSepGuids
  .split(",").map(p => `-1;#|${p};`).join("");

then here is i setup request headers

            o.headers["X-HTTP-Method"] = "MERGE";
            o.headers["IF-MATCH"] = "*";
            o.headers["Content-Length"] = o.body.length;
  • Are you batching the POSTs or running them one by one? – Jussi Palo May 23 at 8:52
  • No batching, posting one by one. Now i'm trying to just update one of those files in particular and API says okay, but in reality attributes are not getting updated. – Anton Viktorov May 23 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.