Skip to content
Discussion options

You must be logged in to vote

Your read is right. Field is mapped to SP.Field only ([SharePointType("SP.Field", ...)] in Field.cs). PnP Core reads with odata=nometadata, so it never learns that the field is really SP.Taxonomy.TaxonomyField. UpdateAsync then sends __metadata: { type: "SP.Field" }, and SharePoint rejects AnchorId on that type. TermSetId, SspId and the other taxonomy properties would fail the same way. There is also no public API to set the anchor today: the CSOM request used by AddTaxonomyAsync hard-codes AnchorId to Guid.Empty (see #1681).

Until that's fixed, send the update yourself with the correct type:

var body = JsonSerializer.Serialize(new
{
    __metadata = new { type = "SP.Taxonomy.TaxonomyField" 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Adam-it
Comment options

@gszdev
Comment options

Answer selected by gszdev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants