views:

180

answers:

1

Hi All, I'm using Sharepoint 2007. Is there a way to CAML query documents (in this example with a ContentType of Invoice) that do not have any workflows assigned to them?

I realize I can pull back all of the Invoices using something like this:

       SPQuery query = new SPQuery();
        query.ViewAttributes = "Scope=\"RecursiveAll\"";
        query.Query= @"<OrderBy>
   <FieldRef Name=""Title"" />
</OrderBy>
<Where>
   <Eq>
      <FieldRef Name=""ContentType"" />
      <Value Type=""Text"">Invoice</Value>
   </Eq>
</Where>";

    SPList list = web.GetList(url);
    SPListItemCollection items = list.GetItems(query);

and then access each indivdual SPListItem Workflows collection, and check to see if the collection is null or has a count of 0.

However, I don't want to pull back 100,000+ invoices when I only need the 50 or so that don't have workflows.

So, I'm looking for a CAML query that allows me to get Invoices without workflows.

Thanks!

Dave

A: 

Have a look at the Stramit CAML Viewer on codeplex I have found it very useful in designing CAML querys in the past. It will allow you to develop CAML querys againt sharepoint 2007 as well as list all the available fields that you could query against.

Nathan Fisher
Yup, already familiar with Stramit. I've also used U2U Query Builder, but neither one shows me how to get at the info I need. Yet, since neither one shows you everything, I was still hoping for something I've missed.
dave wanta