Question

when I debug i can see URL is valid (like below). Shared Documents is tie a to custom content type.

string fileURL = "Shared Documents/Marketing Folder/Sales_Report.txt";
oQuery.Query = @"<Where>
                  <BeginsWith>
                   <FieldRef Name='URL' />
                   <Value Type='Text'>" + fileURL + @"</Value> 
                  </BeginsWith> 
                 </Where>";
oQuery.ViewAttributes = "Scope=\"Recursive\"";

I tried , , all variation but NO SUCCESS. I am so feedup. I wish Microsoft would provide a validation tool for these types.

The url does not show up in the drop when i use u2u.

The following code gives me all the items in the Shared Documents.

            oQuery.Query = @"<Contains>
                              <Eq>
                                 <FieldRef Name='URL' />
                                 <Value Type='URL'>" + fileURL + @"</Value> 
                                </Eq> 
                           </Contains>";
Was it helpful?

Solution

I found the answer on this forum. The u2u caml builder is not sophiscated enough to turn on the recursive mode. So the code worked when I put it in the console app (with query ViewAttributes recursive mode).

sites/SiteCollection/SubSite/Site Documents/Excel Report.xls

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top