Avatar of passion420
passion420
 asked on

The type or namespace UserProfileManager could not be found

Hello experts
I am migrating a web app to new server that is from sharepoint 2007 to sharepoint 2010. I am getting this error below when trying to reach the webite. I have copied the ascx conrol in control templates and it is being referenced on master page which is erroring out.
The type or namespace UserProfileManager could not be found (are you missing a using directive or an assembly reference?)

Following is the code which is on the ascx control. The namepscae appears to be refered and userprofilemanager is used below. not sure why this is erroring out. Please suggest. Do I need to recompile this user control on new server or farm? Please help. Thanks for your help.

<%@ Import Namespace="Microsoft.Office.Server.UserProfiles" %>
  try
                        {
                            ServerContext serverCnxt = ServerContext.GetContext(Context);
                            UserProfileManager upManager = new UserProfileManager(serverCnxt);
                            UserProfile u = upManager.GetUserProfile(HttpContext.Current.User.Identity.Name);
}
 
Microsoft SharePointProgramming Languages-OtherASP.NET

Avatar of undefined
Last Comment
passion420

8/22/2022 - Mon
Bardobrave

According to MSDN documentation Microsoft.Office.Server.UserProfiles is the correct Namespace for the class you are using.

Maybe your project has an assembly still pointing to Sharepoint 2007 that you need to change to SharePoint 2010?
ASKER CERTIFIED SOLUTION
Member_6283346

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
passion420

ASKER
Great. It worked . registered Microsoft.Office.Server.UserProfiles in ascx for some reason it was missing..
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes