1
Vote

DateTime bug

description

I have a DateTime profile property of "date time" type that I map a value and import successfully into, but later it causes SharePoint to blow up when trying to view the user's profile. It appears to be due to a timezone/UTC type issue. Other times/dates work fine.
 
 
I've debugged into this, and everything looks fine. I tried some variations on the DateTime.ParseExact() parameters, but some continued to cause the error, others didn't produce the same time when viewing the profile in SharePoint.
 
 
<Mappings>
<Mapping InputField="AccountName" MOSSField="AccountName" />
<Mapping InputField="MyTimestamp" MOSSField="MyTimestamp" DateFormat="M/d/yyyy h:mm:ss tt"/>
</Mappings>
 
 
<?xml version="1.0"?>
<Inputs>
  <Input>
        <AccountName>QAMR-ACCOUNTS\q714211</AccountName>
        <MyTimestamp>12/1/2006 8:48:26 PM</MyTimestamp>
  </Input>
</Inputs>
 
 
View Profile:
http://localhost/ssp/admin/_layouts/ProfAdminEdit.aspx?guid=c053c485-615d-480f-921a-133713371337&s=a&q=&ConsoleView=Active
 
 
SharePoint shows error:
Hour, Minute, and Second parameters describe an un-representable DateTime. at System.DateTime.TimeToTicks(Int32 hour, Int32 minute, Int32 second)
at System.DateTime..ctor(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second)
at Microsoft.SharePoint.Utilities.DateOptions.ParseTime(String stTime, String format, DateTime& dtTime)
at Microsoft.SharePoint.Utilities.SPUtility.ParseDate(SPWeb web, String stDateTime, SPDateFormat format, Boolean bToUTC)
at Microsoft.SharePoint.Portal.WebControls.ProfileUI.LoadEditValueControl(Property prop, Object[] PropValue)
at Microsoft.SharePoint.Portal.WebControls.ProfileUI.LoadProfileTable()
at Microsoft.SharePoint.Portal.WebControls.ProfileUI.LoadControl(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

comments