Reputation: 21
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" Set-PnPDefaultColumnValues -List "Temp" -Field "DateClosed" -Value "25 September 2020 14:02:52"
Both are leading to "Something went wrong" page.
Thanks, Kiran
Upvotes: 0
Views: 468
Reputation: 21
Thanks for the response.
I came to know that if we pass ISO date format it works.
E.g. Set-PnPDefaultColumnValues -List "Temp" -Field "DateClosed" -Value "2020-08-01T00:00:00Z"
In PowerShell we can easily convert normal DateTime to ISO date format like DateClosed.ToString("o")
Upvotes: 0
Reputation: 2091
The document does not mention whether the Date Column is supported,I tested the date format in various formats, but none of them was set successfully.
As a workaround, you could try :
Set-PnPField -List "Documents" -Identity "date" -Values @{DefaultValue="2020-08-01T00:00:00Z"}
Upvotes: 0