CAML>通过它的URL获取一个项目

Min*_*ari 6 sharepoint caml

这个CAML应该工作吗?(我用u2u试了一下,但是没有显示URL列.)我收到了这个错误.{System.ApplicationException} = {"未正确安装一个或多个字段类型.转到列表设置页面删除这些字段."}

<Where>
 <Eq>
     <FieldRef Name='URL' />
     <Value Type='URL'>/path/HR Policy.docx</Value>
 </Eq>
</Where>
Run Code Online (Sandbox Code Playgroud)

Kit*_*nke 6

查询文档库中的文档

看起来您正在尝试使用CAML在文档库中查找文档.您可以使用名为"FileRef"的隐藏列来执行此操作:

<Where><Eq><FieldRef Name="FileRef"/><Value Type="Url">sites/SiteCollection/SubSite/Site Documents/Excel Report.xls</Value></Eq></Where>
Run Code Online (Sandbox Code Playgroud)

注意:请勿包含服务器名称或开头/.

使用URL字段查询文档或列表项

假设您具有名为"My Document"的URL列的列表或库设置,以下示例.

该链接指向sharepoint服务器上托管的文档(不需要服务器名称):

<Where><Eq><FieldRef Name="My_x0020_Document"/><Value Type="URL">/sites/subsite/Site%20Documents/Excel%20Report.xls</Value></Eq></Where>
Run Code Online (Sandbox Code Playgroud)

该链接是服务器上不存在的内容的绝对URL ...例如http://www.google.com:

<Where><Eq><FieldRef Name="My_x0020_Document"/><Value Type="URL">http://www.google.com</Value></Eq></Where>
Run Code Online (Sandbox Code Playgroud)