Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6672433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:30:28+00:00 2026-05-26T03:30:28+00:00

I am developing a web part in C# which is reading the contents of

  • 0

I am developing a web part in C# which is reading the contents of a SharePoint list.
I can retrieve the values in all the fields I need, except the Target Audience field (which uses AD security groups). I have tried various ways to access this e.g.

string myItem = Convert.ToString(ListItem.properties[“Audience”])

but all I get is null returned. I can see that a target group has been stored in the fueield for thwe item when I edit the item in SharePoint.

How can I retrieve the contents of this field using code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:30:28+00:00Added an answer on May 26, 2026 at 3:30 am

    Try not using the Properties of the ListItem, but the fields themselves.

    In the “Target Audience” field you have some GUIDs stored as strings, these you need to retrieve like so:

    //use the FieldId enumeration for system fields
    string audienceID = item[FieldId.AudienceTargeting] as string;
    string newID = audienceID.Remove(36); //retrieve just the first guid
    Guid audienceGuid = new Guid(newID);
    
    AudienceManager audienceManager= new AudienceManager(SPContext.Current.Site);
    Audience audience = audienceManager.GetAudience(guid);
    

    afterwards you might want to look at audience.GetMembership().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a SharePoint 2010 Web Part (in C#) which needs to pull user
When developing web parts in SharePoint can I inherit from the existing web parts
I am developing silverlight web part for sharepoint 2010. I have an xml file
Good Morning All, I am developing a new ASP.net MVC web application. Part of
I am developing a sharepoint 2007 web part that uses custom properties. Here is
I am developing a web application, part of which contains a the ability to
I am developing a part of a software which has two modules(mail and web-service).But
I am developing silverlight web part. I have a one List Entry log. In
I am developing a Silverlight web part for Sharepoint 2010. I have a button
I am developing silverlight web part for sharepoint 2010. In my project I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.