I'm trying to query a list for all documents (not Folders) that contain a 
ContentTypeId value.

I have the following but I feel my CAML is lacking. It doesn't seem to like 
empty values.

I'm also trusting that the column type for ContentTypeId is in fact 
ContentTypeId.

Help please.

private SPListItemCollection ExecuteQuery(SPList list)
{
   SPQuery qry = new SPQuery();
   qry.Query = "
<Where>
   <And>
      <Neq>
         <FieldRef Name='ContentType' />
         <Value Type='Choice'>Folder</Value>
      </Neq>
      <Neq>
         <FieldRef Name='ContentTypeId' />
         <Value Type='ContentTypeId'></Value>
      </Neq>
   </And>
</Where>
<OrderBy>
   <FieldRef Name='ID' Ascending='True' />
</OrderBy>
<ViewFields>
   <FieldRef Name='FileLeafRef' />
   <FieldRef Name='ContentType' />
   <FieldRef Name='URL' />
   <FieldRef Name='ID' />
</ViewFields>
   ";
   return list.GetItems(qry);
}

Regards,

Paul
Online Developer, ICT
CEO Sydney

_______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to