UpdateListItems(成功)但没有效果?为什么?

时间:2011-12-25 15:48:31

标签: sharepoint soap

我正在尝试创建一个人们可以在SharePoint 2003中更新列表的应用程序。我有一个应用程序可以完美地运行,但这不起作用。

有些SharePoint调用告诉我它为什么不更新?完成后,我获得了“成功”-msg。我只有在那里必须填写蚂蚁它是一个文本行。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js" type="text/javascript"></script>
</head>
<body>
    <h1></h1><span id="numbersOfRows"></span>
<div>
<script type="text/javascript">
    $(document).ready(function() {
    $("#newTaskButton").click(function() {
        CreateNewItem($("#newTaskTitle").val());
    });
}); 

function CreateNewItem(Customer) {
    var batch =
        "<Batch OnError=\"Continue\"> \
            <Method ID=\"1\" Cmd=\"New\"> \
                  <Field Name=\"Event name\">test</Field> \
            </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>On the road</listName> \
              <updates> \
                " + batch + "</updates> \
            </UpdateListItems> \
          </soap:Body> \
        </soap:Envelope>";

    $.ajax({
        url: "homepage/_vti_bin/lists.asmx",
        beforeSend: function(xhr) {
            xhr.setRequestHeader("SOAPAction",
            "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
        },
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: processResult,
        contentType: "text/xml; charset=utf-8"
    });
}
function processResult(xData, status) {
    document.getElementById("alertMsg").innerHTML = status;
}

</script>

    <p>
        Task Title:
        <input id="newTaskTitle" type="text" />
        <input id="newTaskButton" type="button" value="Create Task" />
    </p>
    <h1>Alert:</h1><span id="alertMsg"></span>


</div>

</body>

0 个答案:

没有答案