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???

  • Check the datetime of the server where the timerjob is running (OWSTimer.exe). – Amal Hashim Dec 15 '14 at 14:16
  • Timezone on the server is (UTC+01:00) Brussels, Copenhagen, Madrid, Paris – Mikkel Nielsen Dec 15 '14 at 14:18

Your Answer

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

Browse other questions tagged or ask your own question.