0 out of 1 rated this helpful - Rate this topic

QuickLink Class

Represents a quick link.

System.Object
  Microsoft.Office.Server.UserProfiles.PrivacyItem
    Microsoft.Office.Server.UserProfiles.QuickLink

Namespace:  Microsoft.Office.Server.UserProfiles
Assembly:  Microsoft.Office.Server.UserProfiles (in Microsoft.Office.Server.UserProfiles.dll)
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel = true)]
public class QuickLink : PrivacyItem

The following code example shows the use of the QuickLink class.

[Visual Basic]

      Public Sub QuickLinkSample() 
         'Get portal site context from topology.          Dim strUrl As String = "http://SampleName"          Dim tm As New TopologyManager()          Dim ps As PortalSite = tm.PortalSites(New Uri(strUrl))          Dim pc As PortalContext = PortalApplication.GetContext(ps)           'Initialize user profile config manager object.          Dim upm As New UserProfileManager(pc)          Dim sAccount As String = "mydomain\myalias"          Dim u As UserProfile = upm.GetUserProfile(sAccount)          Dim qlm As QuickLinkManager = u.QuickLinks          Dim strTitle As String = "mylink"          Dim sLinkUrl As String = "http://my"          Dim strGroup As String = "my group"          Dim ql As QuickLink = qlm.Create(strTitle, sLinkUrl, QuickLinkGroupType.UserSpecified, strGroup, Privacy.Public)          Dim iLinkID As Integer = ql.LinkID           'Edit quick link.          Dim qedit As QuickLink = qlm(iLinkID)          qedit.Group = "new group"          qedit.Commit()           'Remove quick link.          qlm.Delete(iLinkID)           'Add another quick link to a person          Dim strTitle2 As String = "mycontact"          Dim sContactAcc As String = "mydomain\mycontact"          Dim ucon As UserProfile = upm.GetUserProfile(sContactAcc)          Dim userguid As Guid = ucon.ID          qlm.AddPerson(strTitle2, userguid, strGroup, False)       End Sub 'QuickLinkSample

[C#]

public void QuickLinkSample() 
{ // Get portal site context from topology. string strUrl = "http://SampleName"; TopologyManager tm = new TopologyManager(); PortalSite ps = tm.PortalSites[new Uri(strUrl)]; PortalContext pc = PortalApplication.GetContext(ps);  // Initialize user profile config manager object. UserProfileManager upm = new UserProfileManager(pc); string sAccount = "mydomain\\myalias"; UserProfile u = upm.GetUserProfile(sAccount); QuickLinkManager qlm = u.QuickLinks; string strTitle = "mylink"; string sLinkUrl = "http://my"; string strGroup = "my group"; QuickLink ql = qlm.Create(strTitle, sLinkUrl, QuickLinkGroupType.UserSpecified, strGroup, Privacy.Public);  // Edit quick link. QuickLink qedit = qlm[iLinkID]; qedit.Group = "new group"; qedit.Commit();  // Remove quick link. qlm.Delete(iLinkID);  // Add another quick link to a person. string strTitle2 = "mycontact"; string sContactAcc = "mydomain\\mycontact"; UserProfile ucon = upm.GetUserProfile(sContactAcc); Guid userguid = ucon.ID; qlm.AddPerson(strTitle2, userguid, strGroup, false);

}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Create method should be used
The sample has been updated to use the Create method instead. The next refresh of the SDK will reflect the change.
Create method of QuickLinkManager should be used to add a new quick link.
QuickLinkManger does not have a Add method as shown in the code snippet above. Create method should be used to add a new QuickLink item.

Example:
QuickLink ql = qlm.Create(strTitle, sLinkUrl, QuickLinkGroupType.UserSpecified, strGroup, Privacy.Public);