views:

104

answers:

2

If a query the SharePoint Web Service Search, is there a way to send a parameter so that it only return documents?

There is of course the possibility to filter the result using the isDocument column, but is it possible during the query?

+1  A: 

What do you mean by "during the query"? Providing a filter on the IsDocument column is applied query time! This is one way to return documents - another could be to create a search scope for documents only. But again, you will need to specify it in the query.

Lars Fastrup
Of course! my brain was temporary disconnected... Here's 15 easy points for you Lars.
Magnus Johansson
:-) Thanks, I also just remembered that you might also be able to use the filter query ContentClass:"STS_ListItem_DocumentLibrary" if all your documents are stored in document libraries created from the default template.
Lars Fastrup
A softie for Lars :-)
Kirk Liemohn
A: 

I guess you can use the beginsWith filhter in the query and query for all items that begins with a documente content type id:

<Where>
    <BeginsWith>
            <FieldRef Name='contentTypeId'/>
            <Value Type='Text'>0x0101</Value>
     </BeginsWith>
</Where>

see here for information about content type id and here is how you can use the query.

Tomso