Add-PNPFile needs -ContentType switch
Reporting an Issue or Missing Feature
Missing Feature
Expected behavior
Add-PNPFile specify optional -ContentType to associate by name or ID [ -ContentType <"ContentTypeId">]
Actual behavior
On a library with multiple contenttypes Add-PNPFile uses the default contenttype.
Steps to reproduce behavior
Use Add-PNPFile on a library with multiple contenttypes
Which version of the PnP-PowerShell Cmdlets are you using?
- [ ] PnP PowerShell for SharePoint 2013
- [ ] PnP PowerShell for SharePoint 2016
- [x ] PnP PowerShell for SharePoint Online
What is the version of the Cmdlet module you are running?
2.10.16
How did you install the PnP-PowerShell Cmdlets?
- [ x] MSI Installed downloaded from GitHub
- [ ] Installed through the PowerShell Gallery with Install-Module
- [ ] Other means
This Doesn't work... Add-PnPFile -Path file.txt -Folder /DocLib -Values @{ "ContentType" = "Custom Content Type Name"}
Looks like this works Add-PnPFile -Path file.txt -Folder /DocLib -Values @{"ContentTypeId" = "0x010100DB61D..." }
We closed this issue as it had not activity within last 180 days. This is a generic process we have decided to perform for issues, which have not been explicitly marked still to be "work in progress" based on tags. We are performing this cleaning to make sure that old issues that have already been solved (but not closed) or are no longer relevant are cleaned out and make the issues more manageable. If this issue still valid, we would ask you to open a new issue and follow the guidance in the issue template related on the recommended location. We do apologize any inconveniences this might cause. Please do remember that issues in the issue lists are also messages for others in the community, so you can also check if you can assist on any of them. “Sharing is caring!”