如何以编程方式在Sharepoint中创建wiki页面(=项目)?
如何在sharepoint中创建wiki页面并添加标题以及一些内容(通过webservices) 到目前为止,这是我的SOAP消息:如何以编程方式在Sharepoint中创建wiki页面(=项目)?,sharepoint,soap,wiki,caml,Sharepoint,Soap,Wiki,Caml,如何在sharepoint中创建wiki页面并添加标题以及一些内容(通过webservices) 到目前为止,这是我的SOAP消息: <soapenv:Body> <soap:UpdateListItems> <soap:listName>Cooking Wiki</soap:listName> <soap:updates> <Batch OnError="Continue">
<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>
烹饪维基
混合两个鸡蛋和一杯牛奶。
它创建了一个新页面,但没有内容和标题。抓取一份副本可以显示大量有趣的信息
您需要名称字段(它包括“.aspx”)。
标题字段在wiki中不相关(空白),页面将按其名称编制索引
--更新--
使用copy.asmx可以上载新文档。模板页面是以前下载过的页面(它不存储任何信息,相当于布局页面)
然后可以调用lists.asmx来更新wikifield。
注意:我还没有弄清楚如何在使用Web服务上载文档后重命名该文档。请查看此页面:
Dan Winter编写了一个很棒的应用程序,我认为它可以提供一些示例代码,请在此处查看:
或者要了解更多信息,.如果没有其他功能可用,您应该开发自己的web服务来提供此功能。众所周知,开箱即用的选项功能有限,但没有什么可以阻止您添加到它们中
我会将其包装到web服务代码中。我已经安装了Sharepoint Manager,并尝试了几乎所有属性:无解决方案:-(是的,看起来wiki是文档库的一个非常特殊的例子。谢谢。我已经知道了。我甚至用文中提到的CopyService做了一个权宜之计。但是这对我来说不是一个合适的解决方案,因为我需要从头开始创建页面。你有权在SharePoint serv上创建自己的web服务吗呃?如果是这样的话,那么你就可以访问整个SharePoint对象模型来创建你的wiki页面。如果这确实是你的一个选择,我也许可以为你拼凑一些示例代码。遗憾的是,这不是一个编写我自己的web服务的选项,因为该解决方案必须在通用SharePoint服务器上工作。遗憾的是,它不是一个选择请编写我自己的web服务,因为该解决方案必须在通用Sharepoint服务器上工作。谢谢,我已经使用它来了解SOAP调用中发生了什么。
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);
}