(Uri, Term) del método SocialTagManager.AddTag
Crea un objeto SocialTag con el especificado Uri y Term.
Espacio de nombres: Microsoft.Office.Server.SocialData
Ensamblado: Microsoft.Office.Server.UserProfiles (en Microsoft.Office.Server.UserProfiles.dll)
Sintaxis
'Declaración
Public Function AddTag ( _
url As Uri, _
term As Term _
) As SocialTag
'Uso
Dim instance As SocialTagManager
Dim url As Uri
Dim term As Term
Dim returnValue As SocialTag
returnValue = instance.AddTag(url, term)
public SocialTag AddTag(
Uri url,
Term term
)
Parámetros
- url
Tipo: System.Uri
term
Tipo: Microsoft.SharePoint.Taxonomy.TermUn objeto Term . El término debe existir en la taxonomía que está utilizando.
Valor devuelto
Tipo: Microsoft.Office.Server.SocialData.SocialTag
Comentarios
La etiqueta social es externa y por lo tanto, visible para los usuarios que no sean el propietario, de forma predeterminada.
Ejemplos
using (SPSite siteColl = new SPSite(url))
{
SPServiceContext serviceContext = SPServiceContext.Current;
SocialTagManager mySocialTagManager = new SocialTagManager(serviceContext);
UserProfileManager myProfileManager = new UserProfileManager(serviceContext);
string myAccount = "mydomain\\myalias";
UserProfile myProfile = myProfileManager.GetUserProfile(myAccount);
System.Uri uri = new System.Uri("url");
TaxonomySession taxSession = mySocialTagManager.TaxonomySession;
TermStore termStore = taxSession.DefaultKeywordsTermStore;
Term term = termStore.KeywordsTermSet.CreateTerm(keyword, termStore.DefaultLanguage);
SocialTag newTag = mySocialTagManager.AddTag(uri, term);
SocialTag[] myTags = mySocialTagManager.GetTags(myProfile);
foreach (SocialTag aTag in myTags)
{
output.Write("<br/> Tag: " + " " + aTag.Url.ToString() + " " + aTag.Term.Name.ToString());
}
}
Using siteColl As New SPSite(url)
Dim serviceContext As SPServiceContext = SPServiceContext.Current
Dim mySocialTagManager As New SocialTagManager(serviceContext)
Dim myProfileManager As New UserProfileManager(serviceContext)
Dim myAccount As String = "mydomain\myalias"
Dim myProfile As UserProfile = myProfileManager.GetUserProfile(myAccount)
Dim uri As New System.Uri("url")
Dim taxSession As TaxonomySession = mySocialTagManager.TaxonomySession
Dim termStore As TermStore = taxSession.DefaultKeywordsTermStore
Dim term As Term = termStore.KeywordsTermSet.CreateTerm(keyword, termStore.DefaultLanguage)
Dim newTag As SocialTag = mySocialTagManager.AddTag(uri, term)
Dim myTags() As SocialTag = mySocialTagManager.GetTags(myProfile)
For Each aTag As SocialTag In myTags
output.Write("<br/> Tag: " & " " & aTag.Url.ToString() & " " & aTag.Term.Name.ToString())
Next aTag
End Using