Friday 12 October 2012

CAML Query Documents from SharePoint Library by Title


I recently faced one issue writing a CAML Query To access documents from SharePoint library By Title
The Query I Used Is As Below
@"<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>SampleData</Value></Eq></Where></Query>";

I was Unable to get the perfect data.

When digging into the matter I Found that “Name” Column is not referring to the “Title” Column.
The internal name is “FileLeafRef”
I was able to get the data by changing Title To “FileLeafRef”.
The below query is working.
@"<Query><Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='Text'> SampleData </Value></Eq></Where></Query>";

No comments:

Post a Comment