CAML > get an item by it's URL

强颜欢笑 提交于 2019-12-07 03:23:55

问题


Should this CAML be working. (I tried it with u2u and it does not display the URL column.) I get this error. {System.ApplicationException} = {"One or more field types are not installed properly. Go to the list settings page to delete these fields."}

<Where>
 <Eq>
     <FieldRef Name='URL' />
     <Value Type='URL'>/path/HR Policy.docx</Value>
 </Eq>
</Where>

回答1:


Querying for a Document in a Document Library

Looks like you are trying to find a document in a document library using CAML. You can do this by using the hidden column named "FileRef":

<Where><Eq><FieldRef Name="FileRef"/><Value Type="Url">sites/SiteCollection/SubSite/Site Documents/Excel Report.xls</Value></Eq></Where>

Note: Do not include the server name or beginning /.

Querying for a document or list item with a URL field

The following examples assuming you have a list or library setup with a URL column named "My Document".

The link is to a document that is hosted on the sharepoint server (do not need server name):

<Where><Eq><FieldRef Name="My_x0020_Document"/><Value Type="URL">/sites/subsite/Site%20Documents/Excel%20Report.xls</Value></Eq></Where>

The link is an absolute URL to something not on the server... for example http://www.google.com:

<Where><Eq><FieldRef Name="My_x0020_Document"/><Value Type="URL">http://www.google.com</Value></Eq></Where>


来源:https://stackoverflow.com/questions/5300860/caml-get-an-item-by-its-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!