Forum Discussion
Mikel2024
Mar 20, 2025Copper Contributor
I like to use multiple ContentTypes with Add-PnPListItem
Hello everybody,
I like to use different fields from different content types in a list but cannot check it in the moment.
Add-PnPListItem [-List] <ListPipeBind> [-ContentType <ContentTypePipeBind>] [-Values <Hashtable>] [-Folder <String>] [-Label <String>] [-Connection <PnPConnection>]
EXAMPLE:
Add-PnPListItem -List $List -ContentType "Item","Comment" -Values @{"Title" = $Title;"Sitecollection" = $SiteCollectionUrl; "Body" = $Body}
Is that possible by separating each existing content type to use all fields?
I tried but was not working for me
Thanks in advance.
Kind regards
Michael
1 Reply
- MooatsRuleIron Contributor
In PnP PowerShell, you can add multiple types of items by specifying the content type ID with the ContentTypeId parameter.