我试图从Java中的Sharepoint列表中删除一个文件,并遇到一些问题。我正在使用批量元素here从Java中的SharePoint列表中删除文件
我能够提出请求,但返回的结果为空且文件未被删除(我没有收到任何错误)。
下面是我使用的UpdateListItems.Update代码:
UpdateListItems.Updates updates = new UpdateListItems.Updates();
updates.getContent().add(this.generateXmlNode(
"<Batch PreCalc='True' OnError='Continue' ListVersion='1' ListName='" + spMoveRequest.getListName() + "'>" +
"<Method ID='1' Cmd='Delete'>" +
"<Field Name='ID'>5</Field>" +//this must be where we specify the file
"</Method>" +
"</Batch>"
));
我再使listSoap对象这样的一个方法调用:
UpdateListItemsResult updateResult = listSoap.updateListItems("<my list name here>", updates);
我以前也试过像使用GUID而不是实际的列表名称,并使用
<Field Name='FileRef'><my file url here></Field>
到IDENT许多变化ify文件。
似乎没有任何工作,我也没有得到任何有用的反馈。
protected Node generateXmlNode(String sXML) throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
DocumentBuilder builder = factory.newDocumentBuilder();
Document documentOptions = builder.parse(new InputSource(new StringReader(sXML)));
Node elementOptions = documentOptions.getDocumentElement();
return elementOptions;
}
,但没有问题检索SharePoint列表时,我已经在过去使用这样的:
的generateXmlNode方法,我使用看起来像这样。
我在这里错过了什么?
看看[这](http://stackoverflow.com/questions/13395038/deleting-a-file-from-sharepoint-using-web-service) 有没有尝试过,但可能工作。 – 2013-03-15 21:50:54
Jeff的链接可能会有所帮助,您可能想使用[Fiddler](http://www.fiddler2.com/fiddler2/)将该代码的输出与您的输出进行比较。如果你有权访问服务器日志,那么你也应该看看那里。 – 2013-03-16 14:21:38