I want to overwrite the existing user profile that are in sp with my own one.

public string AccountName { get; set; }

public string WorkPhone { get; set; }

public string Department { get; set; }

public string Title { get; set; }

public string DistinguishedName { get; set; }

public string WorkEmail { get; set; }

public string Office { get; set; }

        protected void Page_Load(object sender, EventArgs e)

        public void Create()

            string socialDataStatsSite = SPContext.Current.Site.Url;

            using (SPSite siteColl = new SPSite(socialDataStatsSite))

                SPServiceContext serviceContext = SPServiceContext.GetContext(siteColl);

                UserProfileManager userProfileManager = new UserProfileManager(serviceContext);

                UserProfile newProfile = userProfileManager.CreateUserProfile(AccountName, AccountName);








i have put this code in visual studio and deployed it.

Were do i find it in sharepoint to activate it?

  • What did you deploy this as? a feature? a web part? – Ryan Erickson Mar 12 '13 at 21:59
  • @Ryan Erickson hi, in a webpart? – Batistuta Mar 13 '13 at 8:04
  • 1
    If it's in a webpart, then add the web part to a page.. – Fox Mar 13 '13 at 8:10

Create a Console Application & run the same or deploy as a feature & activate on the site.

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.