【问题标题】:Updating SharePoint Online items using SOAP/XML API from outside of SharePoint从 SharePoint 外部使用 SOAP/XML API 更新 SharePoint Online 项目
【发布时间】:2020-06-16 02:23:46
【问题描述】:

我们需要从外部公司的 SharePoint 之外的独立应用程序更新 (CRUD) SharePoint Online 列表项。

此应用程序使用 Soap/XML 调用来调用 SP。

(外部)应用程序能够毫无问题地连接和更新本地 SharePoint 2010 列表,但现在我们正在迁移到 SharePoint Online。

外部应用程序可以连接并查看列表项,但当我们尝试在 SharePoint Online 上更新列表中的项目时总是抛出错误

这是(编辑的)Soap 请求正文和响应:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:UpdateListItems>
         <soap:listName>XXXXXX GUID</soap:listName>
         <soap:updates>
            <Batch OnError="Continue" ListVersion="1" ViewName="XXX GUID CUT">
   <Method ID="1" Cmd="Update">
      <Field Name="ID">1002</Field>
      <Field Name="Received">1</Field>
      <Field Name="COMSBarcode">RL101150</Field>
      <Field Name="DateReceived">2020-03-03</Field>
      <Field Name="ReceivedBy">andras boros</Field>
      <Field Name="DefectsFaults" />
      <Field Name="Description">This is Box 20/1</Field>
   </Method>
   <Method ID="2" Cmd="Update">
      <Field Name="ID">1003</Field>
      <Field Name="Received">1</Field>
      <Field Name="COMSBarcode">RL101151</Field>
      <Field Name="DateReceived">2020-03-03</Field>
      <Field Name="ReceivedBy">andras boros</Field>
      <Field Name="DefectsFaults" />
      <Field Name="Description">This is Box 20/2</Field>
   </Method>
   <Method ID="3" Cmd="Update">
      <Field Name="ID">1004</Field>
      <Field Name="Received">1</Field>
      <Field Name="COMSBarcode">RL101152</Field>
      <Field Name="DateReceived">2020-03-03</Field>
      <Field Name="ReceivedBy">andras boros</Field>
      <Field Name="DefectsFaults" />
      <Field Name="Description">This is Box20/3</Field>
   </Method>
</Batch>
         </soap:updates>
      </soap:UpdateListItems>
   </soapenv:Body>
</soapenv:Envelope>
4:02
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <UpdateListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
         <UpdateListItemsResult>
            <Results>
               <Result ID="1,Update">
                  <ErrorCode>0x81020026</ErrorCode>
                  <ErrorText>The list that is referenced here no longer exists.</ErrorText>
                  <z:row ows_Title="I changed it online (Andras Boros)" ows_T_x002d_Code="X91" ows_BoxNo="20.0000000000000" 
                  {TL:DR}
                  ows_SMTotalFileCount="1002;#0" xmlns:z="#RowsetSchema"/>
               </Result>
               {TL:DR}
             </Results>
            </UpdateListItemsResult>
        </UpdateListItemsResponse>
    </Body>
</soap:envelope/>

是否可以在完全不同的域中从独立 Web 应用更新 SharePoint Online 列表项?

我们将如何处理身份验证。

对此的任何帮助将不胜感激。

【问题讨论】:

    标签: soap sharepoint crud sharepoint-online


    【解决方案1】:

    问题是因为 URL 和 WSDL 是针对顶级网站 SharePoint,而不是特定的子网站。

    一旦我们提供了子站点 url/wsdl,外部应用程序就会开始正常工作

    当您在创建对 Lists.asmx Web 服务的 Web 引用时尝试引用错误的子站点时,将引发错误“The List That is Referenced Here no Longer Exists”。

    “如果您的站点 URL 是 http://my_share_point_site, the list.asmx can be found at http://my_share_point_site/sites/main/_vti_bin/lists.asmx?WSDL 并使用该 URL 来引用 API,那么有些事情可能会起作用。

    当我们尝试更新在某个子站点下找到的列表时,您的更新将静默失败。您必须参考 http://my_share_point_site/sites/main/sub_site/_vti_bin/lists.asmx?WSDL 来更新您的列表。”

    以下是有关此问题的博客文章: SharePoint: The List That is Referenced Here no Longer Exists

    这是一个关于在 SharePoint Online 中调用 lists.asmx 的主题,我们也发现它很有帮助: How to call (_vti_bin) SOAP web service in SharePoint Online 2013 from dot net web application

    此外,在 SharePoint Online 之外,建议使用 SharePoint Online CSOM 而不是 Lists.asmx,Lists.asmx 是主要用于 SharePoint 2010 的旧方式:

    How To Read Various Objects Using SharePoint Online Client Side Object Model (CSOM)

    Complete basic operations using SharePoint client library code

    【讨论】:

      猜你喜欢
      • 2016-01-31
      • 1970-01-01
      • 2017-03-05
      • 2016-05-29
      • 1970-01-01
      • 1970-01-01
      • 2019-08-15
      • 2019-06-06
      • 1970-01-01
      相关资源
      最近更新 更多