Tuesday, April 1, 2008

Audience Targeting won't work with AD Group in MOSS User Group

I’ve already know about this issue and got “bitten” again today. I’m making sure that I’ll remember this time by blogging it.

Audience Targeting now works with MOSS Group as well without a need to create audience rule and compiling them. However, the users must be added to the MOSS user group directly for it to work. Adding AD user group into the MOSS user group will not work. Instead, add the AD group directly when specifying the audience targeting for the web part.

Another side effect of that also means you wouldn’t be able to find out the user’s MOSS group if he is added to the MOSS group via an AD group. The following code gives me no MOSS group at all, even though the person is already added into the MOSS group via AD group:

SPUser user = web.CurrentUser;

Foreach (SPGroup group in user.Groups)

{

                Str += group.Name + “<br/>”;

}

Therefore, do take note of this when you plan to roll out some custom functionality which is base on MOSS user groups.

1 comment:

Anonymous said...

Wev'e also had problems with this. Very true note. Good practice to use audiences for audiance targeting of content etc rather than Sharepoint groups. Use SP Groups for security rather. Beware that if you use big sharpeoint groups +-2000 users in a charepoint group for audience targeting, youll start running into a Search index problem, another reason to go Audiences rather with AD Groups linked to them.