4

如何创建 wiki 页面并添加标题以及 sharepoint 中的一些内容(通过 web 服务)?

到目前为止,这是我的 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>

它创建一个新页面,但它没有内容和标题。

4

4 回答 4

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。注意:我还没有弄清楚如何在使用 web 服务上传文档后重命名文档。

于 2009-06-09T23:22:35.127 回答
2

看看这个页面:

通过 Web 服务在 SharePoint Wiki 上创建内容

于 2009-06-11T19:11:15.233 回答
1

Dan Winter 写了一个很棒的应用程序,我认为它可以提供一些示例代码,请看这里:

维基迁移器

或者,欲了解更多信息,请阅读他的综合博客文章

于 2009-06-17T15:44:29.310 回答
1

如果没有其他工作,您应该开发自己的 Web 服务来提供此功能。众所周知,开箱即用的选项在功能上受到限制,但没有什么能阻止您添加它们。

我会将Nat 的解决方案包装到 Web 服务代码中。

于 2009-06-18T15:01:04.220 回答