I have a problem that annoys me a bit: using UserProfileManager as an unauthorized user.
Problem: The user does not have "Manage user profiles" rights, but I still want to use UserProfileManager. The idea of using SPSecurity.RunWithElevatedPrivileges does not seem to work, as the UserProfileManager is authorized against the SSP, as it seems.
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(inputWeb.Site.ID))
{
ServerContext ctx = ServerContext.GetContext(site);
UserProfileManager upm = new UserProfileManager(ctx,true);
UserProfile u = upm.GetUserProfile(userLogin);
DepartmentName = u["Department"].Value as string;
}
});
This still does not work on the line "new UserProfileManager" with the exception: "You must manage administrator rights to use administrator mode."
, RunWithElevatedPrivileges AppPool. WindowsIdentity.GetCurrent(). "NT AUTHORITY\network service", " " - .
site.RootWeb.CurrentUser.LoginName SHAREPOINT\system , RunWithElevatedPrivileges, Windows ofc.
? " ", (Department, Country, Direct Reports). ?