SharePoint 全天事件给出了模糊的结果 [英] SharePoint All Day Event gives obscure result

查看:66
本文介绍了SharePoint 全天事件给出了模糊的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码在 SharePoint 日历中创建全天事件:

I'm using the following code to create an All Day Event in 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"]

但是,当我查询创建项目的创建日期(如最后一行)时,它给了我 UTC 时间.但是如果是正常事件或重复事件,它会给我当地时间.我试图找到 DateTime 对象的 Kind 属性,但它被设置为 Unspecified.即使通过 SharePoint 站点(手动)创建全天事件,也会出现相同的问题.所以我得出的结论是代码没有任何问题.请帮帮我.

However, when I query for the Created date of the created item (as in the last line ), it gives me the time in UTC. But in case of a Normal event or a recurrent event it gives me the local time. I tried to find the Kind property of the DateTime object, but it is set to Unspecified. The same problem occurs even if an All Day Event is created through the SharePoint site (manually). So I came to a conclusion that there is nothing wrong in the code. Please help me.

推荐答案

查看

SO SharePoint - 全天事件在 CAML 查询中表现不同

这篇关于SharePoint 全天事件给出了模糊的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆