programmatically add a My Link.

November 7, 2008

This is how you add a My Link (aka QuickLink) in code.

Add a Reference to Microsoft.Office.Server

Import/using
Microsoft.Office.Server
Microsoft.Office.Server.UserProfiles 

Dim context As ServerContext = ServerContext.Current
Dim profilmanager As UserProfileManager = New UserProfileManager(context)
Dim profile As UserProfile = profilmanager.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName)
Dim qlmanager As QuickLinkManager = New QuickLinkManager(profile)
Dim ql As QuickLink = qlmanager.Create(pTitle, pUrl, pQuickLinkGroupType, pGroup, pPrivacy)