我想從列表中刪除項目,並具有以下XML的Sharepoint使用UpdateListItems WebService的
<Batch PreCalc='TRUE' OnError='Continue'>
<Method ID='1' Cmd='Delete'>\
<Field Name='ID'>185</Field>
</Method>
</Batch>
這刪除從列表中的項目將返回以下錯誤
0x81020030 - Invalid file name
The file name you specified could not be used. It may be the name of
an existing file or directory, or you may not have permission to
access the file.
它看起來就像我需要提供fileName而不是僅僅使用ID一樣。到目前爲止,我嘗試做到這一點失敗了。
更新
我認爲的XML需要在以下格式:
<Batch PreCalc='TRUE' OnError='Continue'>
<Method ID='1' Cmd='Delete'>
<Field Name='ID'>185</Field>
<Field Name="FileRef">http://sharepoint.mycompany.com/testsite/lib/flying spider 2009-09-03 P.jpg</Field>
</Method>
</Batch>
不引發錯誤但沒有被刪除。
更新2
亞歷克斯的答覆後,我刪除了空間中的URL和已刪除和製表/換行符,因爲這「可能」會導致一個問題:
<Batch PreCalc='TRUE' OnError='Continue'>
<Method ID='1' Cmd='Delete'>
<Field Name='ID'>185</Field>
<Field Name="FileRef">http://sharepoint.mycompany.com/testsite/lib/flying%20spider%202009-09-03 P.jpg</Field>
</Method>
</Batch>
同樣不會引發錯誤。
我應該使用FileRef嗎? FileLeafRef?我應該使用文件名嗎?相對路徑?要歸檔的網址?
如果這事這是個圖片Libary
在正常列表中刪除時,我不需要列表版本或ViewName。無論如何,我不確定要放什麼。現在更新主要問題... – Jack 2009-09-03 15:25:01
我已經嘗試了視圖和列表版本,沒有雪茄。 – Jack 2009-09-03 15:50:08
它仍然看起來像文件名中有空格(見日期之後)。同樣爲了回答更新中的問題,您需要完整的網址。 – 2009-09-03 16:44:52