Forum Discussion
Add-SPOFile fails with format-default : The collection has not been initialized...
- Sep 20, 2016
you're not surpressing error messages in your script? As such it doesn't have to a be a blocking error. The cmdlet just outputs an object where one of the properties has not been loaded by CSOM. The object is still there. The simplest solution is to assign the output of the cmdlet into a variable:
$file = Add-SPOFile etc. etc.
That will 'swallow' the error message and put the resulting object into the $file variable. You will receive the same error when you simply output the results of the $file variable to the output.
you're not surpressing error messages in your script? As such it doesn't have to a be a blocking error. The cmdlet just outputs an object where one of the properties has not been loaded by CSOM. The object is still there. The simplest solution is to assign the output of the cmdlet into a variable:
$file = Add-SPOFile etc. etc.
That will 'swallow' the error message and put the resulting object into the $file variable. You will receive the same error when you simply output the results of the $file variable to the output.
- jeffreymcclainOct 21, 2019Copper Contributor
Erwin van Hunen I see you fixed a similar issue in the Add-PnPFile cmdlet, would it be possible for you to commit a similar fix for the other SharePoint cmdlets (e.g. Add-PnPListItem and Set-PnPListItem )?