我正在尝试从列表中删除一个项目并具有以下 xml
<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.
看起来我需要提供文件名而不仅仅是使用 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? 我应该使用文件名吗?相对路径?文件的网址?
如果这很重要,这是一个图片库