0

I am using Set-PnPDefaultColumnValues to set default values in document library in SharePoint Online and one of the column is DateTime.

When I run this cmdlet for DateTime field I don't get any error but when I click on "Column default value settings" in the Library settings page, I am getting Sorry, something went wrong page (An unexpected error has occurred.), does this cmdlet corrupting library settings?

Also how to set column level default values for DateTime field please?

Example:

Set-PnPDefaultColumnValues -List "Temp" -Field "DateClosed" -Value "01/08/2020" 

And

Set-PnPDefaultColumnValues -List "Temp" -Field "DateClosed" -Value "25 September 2020 14:02:52"

Both are leading to "Something went wrong" page.

enter image description here

2 Answers 2

0

Try using below:

Set-PnPDefaultColumnValues -List "Temp" -Field "DateClosed" -Value "2020-08-01T00:00:00Z"
0

You are receiving this error because SharePoint uses ISO8601 DateTime format (YYYY-MM-DDTHH:MM:SSZ), and the DateTime field is not receiving the correct data.

The sample command provided by Ganesh Sanap is the answer. Just run the command again and the error would go away.

The "Date and Time Format" setting for this field can either be "Date Only" or "Date & Time".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.