我想通过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>"
但这不起作用。 如果我执行上面的代码,将创建一个事件(按预期)。但我不知道如何在活动中添加参与者。
问候
亚历山大