how do I create a wiki page and add a title, as well as some content in sharepoint (via webservices)?
如何创建Wiki页面并添加标题,以及sharepoint中的一些内容(通过webservices)?
This is my SOAP message so far:
到目前为止,这是我的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>
It creates a new page, but it has no content and no title.
它会创建一个新页面,但它没有内容,也没有标题。
4 个解决方案
#1
Grab a copy of SharePoint Manager it can show you heaps of interesting info.
获取SharePoint Manager的副本,它可以显示大量有趣的信息。
you want the Name field (it includes the ".aspx"). The title field is not relevant in a wiki (blank), pages are indexed by thier name instead.
你想要名字字段(它包括“.aspx”)。标题字段在维基(空白)中不相关,页面由其名称索引。
--update--
Using the copy.asmx allows you to upload a new document. The template page is a page that has been downloaded previously (it stores no information, equivalent to a layout page).
使用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);
}
Then you can call the lists.asmx to update the wikifield. Note: I have not figure out how to rename a document once it has been uploaded using webservices.
然后你可以调用lists.asmx来更新wikifield。注意:在使用webservices上传文档后,我还没弄清楚如何重命名文档。
#2
Check out this page:
看看这个页面:
Creating Content on SharePoint Wikis via Web Services
通过Web服务在SharePoint Wiki上创建内容
#3
Dan Winter wrote a fantastic application that I think could provide some sample code, take a look at it here:
Dan Winter编写了一个很棒的应用程序,我认为可以提供一些示例代码,请在此处查看:
Or for more information, read his comprehensive blog posts.
或者有关更多信息,请阅读他的综合博客文章。
#4
If nothing else is working you should develop your own web service to provide this feature. The out-of-the-box options are notoriously limited in functionality but there is nothing stopping you from adding to them.
如果没有其他工作,您应该开发自己的Web服务来提供此功能。开箱即用的选项在功能方面是众所周知的,但没有什么能阻止你添加它们。
I would wrap Nat's solution into the web service code.
我会将Nat的解决方案包装到Web服务代码中。
#1
Grab a copy of SharePoint Manager it can show you heaps of interesting info.
获取SharePoint Manager的副本,它可以显示大量有趣的信息。
you want the Name field (it includes the ".aspx"). The title field is not relevant in a wiki (blank), pages are indexed by thier name instead.
你想要名字字段(它包括“.aspx”)。标题字段在维基(空白)中不相关,页面由其名称索引。
--update--
Using the copy.asmx allows you to upload a new document. The template page is a page that has been downloaded previously (it stores no information, equivalent to a layout page).
使用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);
}
Then you can call the lists.asmx to update the wikifield. Note: I have not figure out how to rename a document once it has been uploaded using webservices.
然后你可以调用lists.asmx来更新wikifield。注意:在使用webservices上传文档后,我还没弄清楚如何重命名文档。
#2
Check out this page:
看看这个页面:
Creating Content on SharePoint Wikis via Web Services
通过Web服务在SharePoint Wiki上创建内容
#3
Dan Winter wrote a fantastic application that I think could provide some sample code, take a look at it here:
Dan Winter编写了一个很棒的应用程序,我认为可以提供一些示例代码,请在此处查看:
Or for more information, read his comprehensive blog posts.
或者有关更多信息,请阅读他的综合博客文章。
#4
If nothing else is working you should develop your own web service to provide this feature. The out-of-the-box options are notoriously limited in functionality but there is nothing stopping you from adding to them.
如果没有其他工作,您应该开发自己的Web服务来提供此功能。开箱即用的选项在功能方面是众所周知的,但没有什么能阻止你添加它们。
I would wrap Nat's solution into the web service code.
我会将Nat的解决方案包装到Web服务代码中。