lundi 15 décembre 2014

Datetime AfterProperties value changed on save



I have written an EventRechiver that results in some strange behavior. I reacths to an Item beeing added to a list. This is done by both users trough UI and by a timer job.


The ER sets some custom datetime fields using this code:



string spString = dateTime.HasValue ? SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateTime.Value.ToUniversalTime()) : String.Empty;
properties.AfterProperties[fieldName] = spString;


the value of "spString" is correct for both the User and job triggered event. But for the Job triggered event, the value that gets saved is 1 hour before the value I see in "spString".


So somehow Sharepoint evaluates on the value and substracts 1 hour. in both cases "spString" are formatted in Zulu "dd-mm-yyyTHH:MM:mmZ"


I have looked at all the regional settings I can find. Both in CA, for the webApp, the sitecollection. All are UTC+1.


Anyone have any idea what the root of this problem might bee???








0 commentaires:

Enregistrer un commentaire