Accessing the sharepoint audience Group RRS feed

  • Question

  • Hi,

    i have crated a Audeience Group in sharepoint.


    Lets say

    Audience a ,b...

    audience a has gotta  10 members and b has gotta 20 members.

    i see that each audience like a,b has created / identified by the GUID (unique id).

    i have this unique id on my local table..i have to pass this unique id from asp.net to sharepoint audience and have to retrive all the members.

    how to do this?..

    can anyone help me out this.

    please let me know if any issues

    • Changed type Mike Walsh FIN Friday, March 11, 2011 12:48 PM always use the question type
    Friday, March 11, 2011 12:07 PM


  • Hi

    Here is the code to get audiences and then you can select required one.

                        AudienceManager audienceManager = new AudienceManager(ServerContext.GetContext(SPContext.Current.Site));
                        if (audienceManager.Audiences.Count > 0)
                            AudienceCollection audienceCollection = audienceManager.Audiences;
                            foreach (Audience audience in audienceCollection)
                                //audience.AudienceID;                  -> stores unique GUID id

    And here is the function how to check whether user (current in this case) becomes the member of audience

                ServerContext context = ServerContext.GetContext(SPContext.Current.Site);
                AudienceManager audManager = new AudienceManager(context);
                return audManager.IsMemberOfAudience(SPContext.Current.Web.CurrentUser.LoginName, strAudienceName);



    Zorayr Zakaryan Lightning Tools

    • Marked as answer by Porter Wang Wednesday, March 16, 2011 1:47 AM
    Tuesday, March 15, 2011 10:12 AM