Sharepoint UserProfileManager without managing user profiles

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). ?

+4
4

.

  • .
  • , , .
  • .

, Network Service. ; Windows. , , .

+4

. : " " , .

But again, it is recommended that you use a domain account in any case (on a test server I used a network service, but after changing it in a domain account it worked).

+2
source

Here's the answer. This is a stupid Microsoft bug, and there is a fix. I download now to check it out.

http://support.microsoft.com/kb/952294/en-us

+1
source

All Articles