Welcome to Comunidade Bloggers |create|it| Sign in | Join | Help

André Vala

SharePoint
Office
FAST Search Server
.Net

News

  • European SharePoint Community Awards 2012 Winner
    Locations of visitors to this page

    Comunidade Portuguesa de SharePoint

    View André Vala's profile on LinkedIn

    © André Vala and Create IT, 2006-2011. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to André Vala and Create IT with appropriate and specific direction to the original content.

SharePoint Tip #23: Creating a Personal Site

The User Profile is the central concept behind the personalization features of SharePoint (MOSS only). In addition to the User Profile, each user can have a My Site. A My Site is composed of:

  • A Profile Page that shows the user profile data, according to the user viewing it and the privacy options of each profile field. You can find that page (Person.aspx) in the root web site of the My Site host site collection (e.g http://mysites/Person.aspx?accountname=domain\username).
  • A Personal Site which is a site collection where you can show personal and public information and documents.

The Personal Site is automatically provisioned for you when you try to access your My Site (using the My Site link or clicking your username). However, you might want to create it programmatically for one or more users, before they even try to access it. See below an example of how to do it.

// open a site collection
using (SPSite site = new SPSite("http://myportal"))
{
    // get the server context
    ServerContext context = ServerContext.GetContext(site);

    // create the profile manager object
    UserProfileManager profileManager = new UserProfileManager(context);

    // get the user profile
    UserProfile profile = profileManager.GetUserProfile("domain\\username");

    // create the user's personal site
    profile.CreatePersonalSite();
}
The really important line of code here is the last one. There rest was already explained in one of my previous posts (WSS Tip #20: Get User Profile).
Posted: Saturday, October 18, 2008 12:25 PM by andrevala

Comments

No Comments

Anonymous comments are disabled