Freigeben über


QuickLinkManager-Klasse

Stellt den Einstiegspunkt für die Verwaltung von QuickLink -Objekten dar.

Vererbungshierarchie

System.Object
  Microsoft.Office.Server.UserProfiles.PrivacyItemManagerBase<QuickLink>
    Microsoft.Office.Server.UserProfiles.QuickLinkManager

Namespace:  Microsoft.Office.Server.UserProfiles
Assembly:  Microsoft.Office.Server.UserProfiles (in Microsoft.Office.Server.UserProfiles.dll)

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class QuickLinkManager _
    Inherits PrivacyItemManagerBase(Of QuickLink)
'Usage
Dim instance As QuickLinkManager
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class QuickLinkManager : PrivacyItemManagerBase<QuickLink>

Beispiele

Im folgenden Codebeispiel wird die Verwendung der KlasseQuickLinkManager.

[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.Add(strTitle, sLinkUrl, strGroup, True)
         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.Add(strTitle, sLinkUrl, strGroup, true);
int iLinkID = ql.LinkID;

//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);
}

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Die Threadsicherheit von Instanzmembern ist nicht gewährleistet.

Siehe auch

Referenz

QuickLinkManager-Member

Microsoft.Office.Server.UserProfiles-Namespace