【发布时间】:2010-07-06 16:18:59
【问题描述】:
如果有人上传文档然后点击取消,我正在尝试使用 sharepoint 网络服务删除文档。我创建了以下函数
function DeleteDocument(libraryName, ID)
{
debug.log('DeleteDocument (Entry) libraryname = '+libraryName+' ID='+ID);
var batch =
"<Batch OnError='Continue'> \
<Method ID='1' Cmd='Delete'> \
<Field Name='ID'>" + ID + "</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>"+libraryName+"</listName> \
<updates> \
" + batch + "</updates> \
</UpdateListItems> \
</soap:Body> \
</soap:Envelope>";
debug.log(soapEnv);
$.ajax({
url: "http://<serverandsite>/_vti_bin/lists.asmx",
beforeSend: function(xhr) {
xhr.setRequestHeader("SOAPAction",
"http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
},
type: "POST",
dataType: "xml",
data: soapEnv,
complete: function(xData, status){
alert(xData.responseText);
debug.log('xData response = ' + xData.responseText);
debug.log('status response = ' + status);
},
contentType: "text/xml; charset=utf-8"
});
}
当我运行它时,我得到了
0x81020030 - 文件名无效
您指定的文件名不能 使用。它可能是一个名字 现有文件或目录,或者您可以 无权访问 文件。
有没有人知道为什么这可能会失败。我正在针对标准文档库运行代码。
我已针对签入和签出文件进行了尝试,并得到了相同的消息。我需要它来针对已签出的文档运行,实际上它们永远不会被签入,所以我不知道如何计算出文件引用
【问题讨论】:
-
只是补充一下,我刚刚尝试强制使用
元素,这会产生相同的错误
标签: jquery web-services sharepoint