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

  • SEARCH
  • Home
  • 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 7645067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:50:43+00:00 2026-05-31T09:50:43+00:00

Background: I have a built-in-house custom SharePoint 2010 web part, inheriting from System.Web.UI.WebControls.WebParts.WebPart ,

  • 0

Background:

I have a built-in-house custom SharePoint 2010 web part, inheriting from System.Web.UI.WebControls.WebParts.WebPart, which has a property defined like so:

[Personalizable(PersonalizationScope.User)]
[WebBrowsable(true)]
[WebDisplayName("...")]
[WebDescription("...")]
[Category("...")]
public string CustomProp { get; set; }

The Powers-That-Be would like to know the value of the property for each of its 3,000 users. I’m already familiar with how to use the SPLimitedWebPartManager to extract the property in either shared view or my own personal view, using code similar to:

var pageUrl = "/Pages/SomePage.aspx";
var limitedManager = SPContext.Current.Web.GetLimitedWebPartManager(
    pageUrl,
    PersonalizationScope.User); // or .Shared, if loading the shared value
var webPart = limitedManager.WebParts.OfType<MyWebPart>().FirstOrDefault();
var prop = webPart.CustomProp;

So, the question:

I’m stuck on collecting this information for all users. Assuming I already have, or know how to retrieve, a list of login names or SPUser objects, how do I go about retrieving the web part property for all users? I can use suggestions in C#, VB.NET, or PowerShell.

  • 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-31T09:50:44+00:00Added an answer on May 31, 2026 at 9:50 am

    Try this code – I haven’t tested it but I think it should work.

    const string absolutePageUrl = "http://spsite:5000/Pages/SomePage.aspx";
    
    foreach (SPUser user in SPContext.Current.Site.RootWeb.AllUsers.Cast<SPUser>())
    {
        if (!user.LoginName.StartsWith("DOMAIN NAME"))
            continue;
    
        using (SPSite site = new SPSite(absolutePageUrl, user.UserToken))
        using (SPWeb web = site.OpenWeb())
        {
            var mgr = web.GetLimitedWebPartManager(absolutePageUrl, PersonalizationScope.User);
            var webPart = mgr.WebParts.OfType<MyWebPart>().FirstOrDefault();
            var prop = webPart.CustomProp;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background : I have built a tool that imports sales orders from Magento to
BACKGROUND: I have built a web application for a client which allows them to
Background I have built a VB .NET application on the 4.0 Framework, part of
Background: I have a WebPart that makes use of the SPCalendarView control and in
I have built a semi-transparent custom layout panel in WPF by setting the Opacity
Background: I have a website that has been built with ASP.NET 2.0 and is
I have built a C# .net web service that takes a complex type as
I built a NSOperation to run on a background thread, but I have since
I have a web-application built with GWT (2.0.3) and run on Apache Tomcat 6.
Background: I'm currently debugging an application written over a custom-built GUI framework in C++.

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.