How to create Personal Site Programmaticaly..

Alright, I got “How to Create Personal Site Programmatically from MSDN (it was there in one sample chapter of Resource Kit)


Dim topology As New TopologyManager
Dim collection As
PortalSiteCollection
Dim portal As
PortalSite
portal = topology.PortalSites(New
Uri(http://yoursite.yourdomain.com))
Dim context As PortalContext = PortalApplication.GetContext(portal)

'initialize user profile config manager object

Dim profileManager As New UserProfileManager(context)
Dim profile As
UserProfile
For Each profile In
profileManager
          Console.Write(("Creating a Personal Site for " + profile("PreferredName") + "…"))
  Try
          profile.CreatePersonalSite()
          Console.Write("Success! Created :" + profile("PreferredName") + "…" + ControlChars.Lf)
   Catch
          Console.Write("Site Already Exists!" + profile("PreferredName") + ControlChars.Lf)
   End
Try
Next profile

Leave a Reply