SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to query a list in an eventreceiver through properties.List.GetItems (in the itemadding event). The field I'm filtering on is a 'Person or Group' field. But the query always returns all items instead of just the ones having the user I provided.

I'm using following code:

I've already checked following post: link but this didn't resolve my problem.

the query I use is:

        <Eq><FieldRef Name='Gebruiker' LookupId='TRUE' /><Value Type='Integer'>{0}</Value></Eq></Where>

I Also tried:

<Where><Eq><FieldRef Name='Gebruiker' LookupId='TRUE' /><Value Type='Lookup'>{0}</Value></Eq></Where>

Any help is welcome

share|improve this question

I found it in the meanwhile :)

When I passed the query as a string to the GetItems function it wasn't working correctly. However when I create a SPQuery-object, pass the query (the string) to the Query property of that object and then pass that object to the GetItems function it works correctly :) .

share|improve this answer

Your Answer


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.