Programatically Create My Site in Sharepoint 2010

A short code snippet for Programatically creating My Sites in SharePoint 2010

public void CreateMYSite()
SPServiceContext serviceContext = SPServiceContext.Current;

UserProfileManager up = new UserProfileManager(serviceContext);

string sAccount = "domain\\user";
UserProfile uprof = up.GetUserProfile(sAccount);


SPSite newmysite = uprof.PersonalSite;


Post a Comment


This is a personal weblog. The opinions expressed here represent my own and not those of my employer or anyone else. Should you have any questions or concerns please e-mail me at .

Copyright (c) 2010 @ All rights are reserved.Do Not Copy.

@ Learning