pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
987 stars 665 forks source link

Set-PnPListItem - Content Type Not Updating #1963

Open kcaenj opened 5 years ago

kcaenj commented 5 years ago

I am attempting to test out a script that I want to use to update the content type of about 2000 records based on the value of another field.

When I use this code - it runs but when I check the record in question the Content Type has not changed? Am I missing something?

Set-PnPListItem -List "GTD_DEV_Mapping" -Identity 6 -ContentType "MRC"

I know the Content Type value is valid.

ypcode commented 5 years ago

Hi,

Your use case reminded me a post I written quite a while ago (https://ypcode.wordpress.com/2016/12/08/cross-sharepoint-platform-maintenance-tools-using-pnp-powershell/).

In the script I wrote back then, I can't remember exactly why but I used the content type object instead of the name, maybe that would work better ?

RichieRoxx commented 5 years ago

Same issue. It works if you use the content type object, but still a hurdle, especially as the documentation uses the content type name as a string instead of an object...