2

There is a date list column I'm having trouble updating since there is a validation formula linked to it.

=(TEXT([Week Ending],"dddd")="Saturday")

The date that gets inputted for the Week Ending column must be on a Saturday. What I'm trying to do is copy some items from that same list based on a query, and certain columns (not all) will be updated with new values. The query works fine (returning the expected number of items) and I have the new date value in a format that SharePoint list accepts (MM/dd/yyyy) if I was using the SharePoint UI to update/add it. The thing is in PowerShell, it throws a "List data validation error" even though it's in the same date format used to add an item to the list manually. I really think the error has something to do with the validation formula above. Since it's using dddd and not dd like in the format used by the PowerShell.

And the date I'm using to update items does fall on a Saturday, so it makes me think it's how I'm formatting it primarily.

Basically, an item won't get updated with a new date because the validation formula is causing some issues even though it's in the seemingly correct format and passes the validation.

2

So, it ended up being a very simple solution to this. The date I was using to update the items was a string, and I needed to convert it to a date object. There didn't need to be any changes made to the validation formula or date formatting aside from converting "MM/dd/yyy" by using this ($newItemDate was the original date string):

$newItemDate = [datetime]$newItemDate 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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