Set-PnPDefaultColumnValues Index was outside the bounds of the array #2149
Replies: 2 comments 4 replies
-
Have you tried not using the "FieldInternalName" and use the Display Name of the field? I am able to get Set-PnPDefaultColumnValues to work. See the example code I put in the issue I opened yesterday: My issue with Set-PnPDefaultColumnValues using managed metadata is that eventually, if used enough times, it will fail with the "Index was outside the bounds of the array". And it corrupts the default column values in the library, and the only way to fix it is to delete and rebuild the library. In the example code I posted in the issue above, it happens after 3 calls. This occurs when I use a Custom Property on a term and use it on folders more than 2 levels deep. But it will eventually occur even without Custom Properties and folders 1 level deep, it just takes many more calls to Set-PnPDefaultColumnValues. But eventually it happens. There is no reason I can pinpoint, But once it occurs (after successful calls), you can never use it again on that library - it will fail every time. I do not see this behavior with Text fields however (so far). Only managed metadata fields. |
Beta Was this translation helpful? Give feedback.
-
Was receiving the message "Index was outside the bounds of the array". Upgrading to PnP.PowerShell 2.4.0 solved the issue for me. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to set a default value on a managed metadata column on a subfolder however I get:
Set-PnPDefaultColumnValues : Index was outside the bounds of the array.
I've tried different approaches:
$DocumentType = "Group|TermSet|TermValue" or $DocumentType = "wssid;#label|guid" or $DocumentType = "Guid of Term"
$FolderPath = "/Folder1/Folder2" or "Folder1/Folder2":
Set-PnPDefaultColumnValues -List "ListName" -Field "FieldInternalName" -Folder $FolderPath -Value $DocumentType -Connection SPsiteConnection
I've tried on a Single line of text column as well and same result:
Set-PnPDefaultColumnValues : Index was outside the bounds of the array.
On a side note: I played around with the -list parameter when I was testing and the strange thing is that if I put in a wrong value (non existing list) for -list it does NOT throw any exception.
Using: PnP.PowerShell 1.11.0
Beta Was this translation helpful? Give feedback.
All reactions