Forum Discussion
kojima_yuki1023
Mar 03, 2023Copper Contributor
Error about ”format-default:The collection has not been initialized.”
■ Phenomenon that occurred
When executing a ps1 file, the following error occurred in the process using the "Add-PnPFile" command. "format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested." The above was resolved by storing the Add-PnPFile command in a variable.
・Before correction: Add-PnPFile
・After correction: $x = Add-PnPFile Reference: https://sharepoint.stackexchange.com/questions/272614/format-default-the-collection-has-not-been-ini...
■ Questions
I have two questions below.
1. Please let us know if there is anything that could be the cause of the "
format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested." error.
2. Regarding the above solution, although it started to work normally, I am not sure why the problem was resolved. I would appreciate it if you could tell me why the error was resolved by storing the command in a variable.
No RepliesBe the first to reply