SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've currently written a proof of concept console application to add a single user to our user profile service, using the SharePoint web services


I have found that reading in a user can use my default network credentials, however the only way I can update or create a user, I have to use the farm system account.

When using the SharePoint dll's (instead of the webservice). I found that all I had to do was ensure my User Profile service had the same permissions as the user running my application. However changing the User Profile service permissions for the web service doesn't make a slightest bit of difference.

I don't wish to hard code (or put in app.config) the username and password of our farm account, I don't mind using a less privedge account, but using a less privedge account how do I give them access so that the web service works?

My code, (if it helps anyone out) is below. Thanks.

private static UserProfileWS.PropertyData[] CreateUserProfile(string accountName)
            UserProfileWS.PropertyData[] property = null;
                var url = Properties.Settings.Default.UserProfileWSImport_UserProfileWS_UserProfileService;
                var myService = new UserProfileWS.UserProfileService();
                NetworkCredential nc = new NetworkCredential();
                nc.Domain = Properties.Settings.Default.Domain;
                nc.UserName = Properties.Settings.Default.UserName;
                nc.Password = Properties.Settings.Default.Password;

                myService.PreAuthenticate = false;
                myService.Credentials = nc;
                myService.Url = url;

                //If I use either of the lines below instead of NetworkCredentials I get a access denied error when running myservice.CreateUserProfileByAccountName(accountName)
                // myService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; 
                //myService.UseDefaultCredentials = true;

                property = myService.CreateUserProfileByAccountName(accountName);

            catch (Exception ex)

            return property;

share|improve this question
up vote 2 down vote accepted

Found the answer after a bit more searching.

To set the Manage Profiles permissions do as follows:

1.Go to Central Admin

2.Choose Application Management > Manage Service Applications

3.Select the User Profile Service Application (do not click the link)

4.Click Administrators in the ribbon

5.Add the user and set the Manage Profiles permission for it

6.Click OK

7.Your done!

share|improve this answer
You made my day! Thank you for using ASMX and NetworkCredentials - I work from outside the domain of the sharepoint and OOTB there is only the network service build in configured as an admin for profile management service (sound a bit weird - all this security and after all network service can create users?). Regards, Michael – user13937 Jan 7 '13 at 14:22
Awesome Sauce! I wish I saw this hours ago. – David Jenkins Jul 24 '14 at 20:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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