CAML Queries are troublesome at the best of times. I find it best to use a tool or a tried and tested method like the one I use here Tip - Creating CAML Queries - Thinking out aloud - Dave Hunter's.
When you create a view and you want to show only items that have been created by the current user you use the [Me] keyword.
For example: filter by "Author" equals [Me].
How can I do this using a CAML query?
The [Me] keyword is represented in CAML by the following <Value Type="Integer"><UserID Type="Integer"/></Value>.
In the CAML query for returning items that the current user has created becomes ...
<Where><Eq><FieldRef Name='Author' /><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Where>
Mirjam has done a good job of writing this up http://www.sharepointblogs.com/mirjam/archive/2009/07/16/creating-a-custom-view-that-filters-on-the-current-user-or-me.aspx. Glad I could help.
2009/09/24
CAML Query that filters on the current user
التسميات:
SharePoint
Subscribe to:
Posts (Atom)