Getting error when updating multi-value metadata field

Brass Contributor

I am using PnPJS 2.3.0 updated code to update multi-value metadata field :

await list.items.getById(itemId).update({
"My_x0020_Metadata_x0020_2": "-1#;Accountant|70edea16-6811-4e4f-ac27-8f1c567ad01e;#-1#;Designer|302dcafd-c992-4688-9f56-5e30c7e74b86;#-1#;Developer|7a139032-0898-4268-8917-64db96397d43;#-1#;Director|f1764c7b-f8b9-4fc0-a061-5f9403382311;#"
});

Another code also :

await list.items.getById(itemId).update({
"My_x0020_Metadata_x0020_2": "Accountant|70edea16-6811-4e4f-ac27-8f1c567ad01e;Designer|302dcafd-c992-4688-9f56-5e30c7e74b86;Developer|7a139032-0898-4268-8917-64db96397d43;Director|f1764c7b-f8b9-4fc0-a061-5f9403382311;"
});

it is throwing error :

error Error: Error making HttpClient request in queryable [400] ::> {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected."}}}

 

Thanks,

Gaurav Goyal

0 Replies