pnp / pnpcore

The PnP Core SDK is a modern .NET SDK designed to work for Microsoft 365. It provides a unified object model for working with SharePoint Online and Teams which is agnostic to the underlying API's being called
https://aka.ms/pnp/coresdk/docs
MIT License
288 stars 188 forks source link

Failed to update field of type Term (Managed Metadata) #1454

Closed IllumiC closed 2 months ago

IllumiC commented 2 months ago

Category

Describe the bug

I have a column of type managed metadata that is configured to accept any term within a specific term set in my site. The column is used in various custom content types, of type (a) item, (b) document set, (c) document.

When creating an item via GUI, the term is applied successfully across all 4 content type scenarios.

When creating an item via Powershell PnP, the term is applied successfully across all 4 content type scenarios.

When creating an item via Core SDK PnP, I am experiencing difficulty.

Item

Steps to reproduce

Item

  1. Attempt to add a list item using IList.Items.AddAsync()
  2. Receive the error _SharePointRestServiceException: There was an exception while writing field MSD_EntityType. Verify you're using the correct InternalName value for the field you want to write to.

Document Set

  1. Attempt to edit document set properties using IFolder.Properties["Term_Internal_Name"], followed by IFolder.Properties.UpdateAsync()

Expected behavior

The term field is populated upon edit.

Environment details (development & target environment)

jansenbe commented 2 months ago

@IllumiC : did you check this https://pnp.github.io/pnpcore/using-the-sdk/listitems-fields.html#taxonomy-fields?

IllumiC commented 2 months ago

@jansenbe Thank you for your quick reply. I solved my issue with the help of the article you suggested.

Solution

Item

Document Set