Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to query a list in SharePoint 2007 to get the items of the list that were created by a specified user. Here is my CAML:

<Query>
    <Where>
        <Eq>
            <FieldRef Name="Author" />
            <Value Type="Text">1073741823;#System Account</Value>
        </Eq>
    </Where>
</Query>

Actually, I've tried it lots of different ways, but no matter what I try, I get SoapServerException. I've tried changing around the Name attribute of the FieldRef and the Type attribute of the Value, as well as the inner text of the Value. There doesn't seem to be any documentation on how to create a CAML query like this... What should I do to make it work?

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

if you have the user id you could try something like this:

<Where>
<Eq>
<FieldRef Name='fieldname' LookupId='TRUE' />
<Value Type='Lookup'>lookupid
</Value>
</Eq>
</Where>
share|improve this answer
add comment

This will work:

<Query>
    <Where>
        <Eq>
            <FieldRef Name="Author" />
            <Value Type="Text">System Account</Value>
        </Eq>
    </Where> 
</Query>

When querying for a particular name, the Type attribute of the Value must be text and the inner text of the Value node must be the user profile Name, as returned by the usergroup.asmx service method GetAllUserCollectionFromWeb.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.