.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links


Posted By:      Posted Date: August 31, 2010    Points: 0   Category :SharePoint
SPSite ospSite = new SPSite("http://localhost/"); ServerContext context =ServerContext.GetContext(ospSite);   UserProfileManager profileManager = new UserProfileManager(context); on creating a UserProfileManager.  Throws error "object reference not set to an Instance of an Object" 

View Complete Post

More Related Resource Links

UserProfileManager.GetUserProfile for AD User


Here is my problem:  I'm trying to get a user profile for a user who has access to a site by way of being a member of an AD group that has access to the site.  So, the user can access the site, but the code UserProfileManager.GetUserProfile(userLoginName) returns the error "User Not Found: Could not load profile data from the database.".  If I go a step further and specifically add the AD user as a user to the site, the code works.  We currently provide read access to our sites by adding the AD group for all registered users to a specific site.  Is there any way for me to grab a users profile even though they aren't specifically added to the context site the code is running in?

The code is a web part.  Snippet:

UserProfileManager profileManager = new UserProfileManager(ServerContext.Current);
          UserProfile profile_User = profileManager.GetUserProfile("domain\\username");

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend