Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a problem with regards to configuration on production environment. It turns out that user for User Profiles sync may not be given Replicate directory changes on root OU, which is needed for sync to work. Now, I need user profiles so the workflows can work. Is there a workaround here? I was thinking about some manual way of importing users, perhaps Powershell, saving data from AD into file and importing it again programmatically?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Workaround is to implement some custom functionality that does the import. It can be PowerShell, Windows Service, pretty much anything that can query AD and can access SharePoint via SharePoint Server Object Model.

Note that you need to handle addition, updating, and possibly also removal scenarios, and figure out what User Profile Fields in SharePoint to override using AD values in case user has manually updated those in MySite.

E.g., create user profile in SharePoint using Server Object Model in case you would use Windows Service:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;
using System.Web;
namespace UserProfilesSSOM
    class Program
        static void Main(string[] args)

            // Replace "domain\\username" and "servername" with actual values.
            string newAccountName = "domain\\username";
            using (SPSite site = new SPSite("http://servername"))
                SPServiceContext serviceContext = SPServiceContext.GetContext(site);

                    // Create a user profile that uses the default user profile
                    // subtype.
                    UserProfileManager userProfileMgr = new UserProfileManager(serviceContext);
                    UserProfile userProfile = userProfileMgr.CreateUserProfile(newAccountName);

                    Console.WriteLine("A profile was created for " + userProfile.DisplayName);

                catch (System.Exception e)
                    Console.WriteLine(e.GetType().ToString() + ": " + e.Message);
share|improve this answer

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.