Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

PowerShell: How do I set a null DateTime field from a DB in a list?

$
0
0

I am new to PowerShell and putting together a script that would update a SharePoint List with data from an SQL Database table. Right now, I am able to update all types of fields in the list...except for the date fields, when there is no data in the Db table. Right now, i am doing something like this...

$newItem["Created_x0020_On"] = $row."created_on"
but each time there is a "Null" entry in the Db table, my script gives me an error message that states "String was not recognized as a valid DateTime". Again, this happens when the entry in the Db is "Null"...how do I go about just getting this to have a blank entry when this is the case? 

Thanks for the ideas.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>