Question

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

Était-ce utile?

La solution

Try using below:

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

Autres conseils

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".

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top