我想通过 Web 服务 API 以编程方式将事件添加到 SharePoint 2010 中的组日历。
这是我已经做过的:
service = new SharePointListsService.Lists();
service.PreAuthenticate = true;
service.Url = "http://sharepoint/_vti_bin/lists.asmx";
service.Credentials = CredentialCache.DefaultNetworkCredentials;
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");
elBatch.SetAttribute("ListVersion", "1");
string strBatch = "<Method ID='1' Cmd='New'>" +
"<Field Name='Title'>New Test</Field>" +
"<Field Name='Description'>New Description</Field>" +
"<Field Name='Location'>TestTitle1</Field>" +
"<Field Name='EventDate'>" + DateTime.Now.ToString("yyyy-MM-dd") + "</Field>" +
"<Field Name='EndDate'>" + DateTime.Now.ToString("yyyy-MM-dd") + "</Field>" +
"<Field Name='Category'>My Category</Field>" +
"<Field Name='fAllDayEvent'>1</Field>" +
// @"<Field Name='Participants'>Domain\Username<Field>" +
"</Method>";
elBatch.InnerXml = strBatch;
var returnValue = service.UpdateListItems("MyList", elBatch);
如何将参与者(参加者)添加到活动中?我尝试像这样添加它们:
@"<Field Name='Participants'>Domain\Username<Field>"
但这不起作用。如果我执行上面的代码,将创建一个事件(如预期的那样)。但我不知道如何将参与者添加到活动中。
问候
亚历山大