如何创建Wiki页面并添加标题,以及sharepoint中的一些内容(通过webservices)?
到目前为止,这是我的SOAP消息:
<soapenv:Body>
<soap:UpdateListItems>
<soap:listName>Cooking Wiki</soap:listName>
<soap:updates>
<Batch OnError="Continue">
<Method ID="1" Cmd="New">
<Field Name="WikiField">Mix two eggs and a cup of milk.</Field>
</Method>
</Batch>
</soap:updates>
</soap:UpdateListItems>
</soapenv:Body>
它会创建一个新页面,但它没有内容,也没有标题。
答案 0 :(得分:4)
抓取SharePoint Manager的副本,它可以显示大量有趣的信息。
你想要名字字段(它包括“.aspx”)。 标题字段与wiki(空白)无关,而页面则由其名称索引。
- 更新 -
使用copy.asmx可以上传新文档。模板页面是先前已下载的页面(它不存储任何信息,相当于布局页面)。
private byte[] GetTemplatePage()
{
FileStream fs = new FileStream("templatePage.aspx", FileMode.Open);
byte[] fileContents = new byte[(int)fs.Length];
fs.Read(fileContents, 0, (int)fs.Length);
fs.Close();
return fileContents;
}
private void UploadDoc(string pageName)
{
byte[] wikiBytes = GetTemplatePage();
string dest = "http://[website]/wiki/Wiki%20Pages/" + pageName + ".aspx";
string[] destinationUrlArray = new string[] { dest };
IntranetCopy.Copy copyService = new IntranetCopy.Copy();
copyService.UseDefaultCredentials = true;
copyService.Url = "http://[website]/wiki/_vti_bin/copy.asmx";
IntranetCopy.FieldInformation fieldInfo = new IntranetCopy.FieldInformation();
IntranetCopy.FieldInformation[] fields = { fieldInfo };
IntranetCopy.CopyResult[] resultsArray;
copyService.Timeout = 600000;
uint documentId = copyService.CopyIntoItems(dest, destinationUrlArray, fields, wikiBytes, out resultsArray);
}
然后你可以调用lists.asmx来更新wikifield。 注意:在使用webservices上传文档后,我还没弄清楚如何重命名文档。
答案 1 :(得分:2)
答案 2 :(得分:1)
Dan Winter撰写了一篇精彩的应用程序,我认为可以提供一些示例代码,请在此处查看:
或者有关详情,请read his comprehensive blog posts。
答案 3 :(得分:1)
如果没有其他工作,您应该开发自己的Web服务来提供此功能。开箱即用的选项在功能上是众所周知的,但没有什么能阻止你添加它们。
我会将Nat's solution包装到网络服务代码中。