Filtering a View by Group Membership

There are a number of possible solutions to this problem:

If you have the SharePoint Server (i.e. not foundation) then you could use the Audience feature and set the audience to the group. You would then display the data using the Content Query Web Part. The CQWP is available only when the Publishing features are enabled. (So this one does not help with Views.)

Customize the web part (view) in SharePoint Designer. See the solution below.

Filtering a View by Group Membership

This is not security! Other views of the list will still display all of the items.

The XML query can be much, much more complicated with the addition of ANDs and ORs. For example, you might add an OR section to always show all items for site owners.

The following works on a view (XsltListViewWebPart), but will also work with a Data View (DataFormWebPart). For the DataFormWebPart you will have a little more work to do as the WHERE is embedded in the "selectcommand" string and all of the brackets are "escaped". Example: You will need to write the WHERE as a single line of text and replace each "<" with "&lt;" and each ">" with "&gt;".

The following is for SharePoint 2010 and Office 365 (2010)…

If you don't have a convenient group for testing, go create a SharePoint group with a few people who can help you test this.

i am trying to implement it on the custom list view. but getting nothing. i have added the user to that group. but it is not working for me.And also it is not showing any xml error. So,that i can look into caml query syntax.