I use the following code to create an All Day event on a SharePoint calendar:
newitem = listobject.Items.Add() guid = System.Guid.NewGuid() newitem["Name"] = "All Day Event " + guid.ToString() newitem["Title"] = "All Day Event " + guid.ToString() newitem["Start Time"] = System.DateTime.Now.Date newitem["End Time"] = System.DateTime.Now.Date newitem["Description"] = "Created by Automation Script" newitem["Location"] = "Location " + guid.ToString() newitem["UID"] = guid newitem["All Day Event"] = 1 newitem.Update() print newitem["Created"]
However, when I request for the Created date of the created item (as in the last line), it gives me time in UTC. But in the case of a normal event or a recurring event, this gives me local time. I tried to find the Kind property of a DateTime object, but it is set to Unspecified. The same problem occurs even if the Day event is created on a SharePoint site (manually). Therefore, I came to the conclusion that there is nothing wrong with the code. Please help me.
sharepoint sharepoint-2007
Prabhu
source share