0

リストWebサービスの「UpdateListItems」メソッドを使用してSharePointリストアイテムを更新しようとしています。CAMLクエリ:

"<Method ID='1' Cmd='Update'>" +
           "<Field Name='ID'>" + itemID + "</Field>" +
           "<Field Name='Status'>" + itemStatus + "</Field></Method>"

itemID、itemStatusであり、UIからパラメーターとして渡されます。これにより、次のエラーが発生します

<Result ID="1,Update">
<ErrorCode>0x80070005</ErrorCode>
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x80070005)
</ErrorText>
</Result>

誰でも助けることができます。もう1つの質問は、更新方法がIDに基づいてのみ機能するか、タイトルも渡す可能性があるかどうかです。

ありがとう

4

2 に答える 2

1

現時点では必要ないかもしれませんが、これは同じ問題に直面している他の誰かにとって役立つかもしれません.

このエラーの原因は、SOAP アクションのヘッダーである場合があります。更新を行うには、以下を設定する必要があります。

beforeSend: function(xhr) { xhr.setRequestHeader("SOAPAction", " http://schemas.microsoft.com/sharepoint/soap/UpdateListItems ");

Sharepoint リストで更新を送信する次の関数を作成しました。

function sendupdates(location,listName,command,fieldnames,fieldvalues){
      var updatesvar;
      for(x=0;x<fieldnames.length;x++){
      updatesvar =   updatesvar + '<Field Name="'+fieldnames[x]+'">'+fieldvalues[x]+'</Field>'
         }

      var batchvar = '<Batch OnError="Continue" ListVersion="0"><Method ID="1" Cmd="'+command+'">'+updatesvar+'</Method></Batch>';

      var soapEnv =
                  '<?xml version="1.0" encoding="utf-8"?>'+
                  '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+
                  '<soap:Body>'+
                  '<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">'+
                  '<listName>'+listName+'</listName>'+
                  '<updates>'+batchvar+'</updates>'+
                  '</UpdateListItems>'+
                  '</soap:Body>'+
                  '</soap:Envelope>';

           $.ajax({
                  url: location+"/_vti_bin/Lists.asmx",
                  beforeSend: function(xhr) { xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");},
                  type: "POST",
                  dataType: "xml",
                  data: soapEnv,
                  complete: complete,   
                  contentType: "text/xml; charset=\"utf-8\""
              });

  }
于 2015-06-04T14:03:37.450 に答える
0

次の CAML ツールのいずれかを使用してみてください: http://msdn.microsoft.com/en-us/library/ff648040.aspx

于 2011-08-09T00:29:51.917 に答える