I'm retrieving user profiles data from SharePoint user profile.

Its working fine.

I have SharePoint site http://pc5 and user with login name pc5\akshay for this user I'm able to get data from user profile.

But I have another user with login name SHAREPOINT\system, and I'm unable to get user data from user profile for this user .

using (SPWeb web = site.OpenWeb())
            SPUser user = SPContext.Current.Web.CurrentUser;
            SPUser CurrentUser = user;
            var userLoginName = CurrentUser.LoginName;
            SPServiceContext serviceContext = SPServiceContext.GetContext(site);
            var profileManager = new UserProfileManager(serviceContext);

            String[] breakApart = userLoginName.Split('|');
            var accountName = breakApart[1]; 
            var userProfile = profileManager.GetUserProfile(accountName);

                    Profile = userProfile;

                    var Department = userProfile["Department"].Value != null
                        ? userProfile["Department"].Value.ToString()
                        : "";

                    var CurrentLocation = userProfile["SPS-DistinguishedName"].Value != null
                        ? userProfile["SPS-DistinguishedName"].Value.ToString()
                        : "";
                    if (CurrentLocation != null)
                        String[] breakLocation = CurrentLocation.Split(',');
                        var OU = breakLocation[1];
                        String[] breakOU = OU.Split('=');
                        var location = breakOU[1];


Please help me with this


System account is basically the Web application pool account user which you have passed during web application creation phase. You cannot find this user with account name "SharePoint\System" in User Profile.

This is the account which is used when you run your code in under elevated privileges by SPSecurity.RunWithElevatedPrivileges

Account name with "SharePoint\System" is not available in the Service. It's not recommended to use "SharePoint\System" account as end user purpose.

You should try with all other users except system account.

You can check for this user from Central Administration. Go to Central admin >> User Profile service >> go to Manage Profiles and here try to search user using "SharePoint\System" , you will find nothing. This means user with this account name is not available in the Service.

  • that make sense to me – Akshay Dattatray Nangare May 5 '17 at 7:28
  • Kindly mark as accepted answer and up vote my answer if it's helpful to you.😊 – Dikesh Gandhi May 6 '17 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.