Voici mon code pour marquer une page avec un tag et un titre. Plus tard dans le code, je boucle et affiche l'URL et la balise associée. Ici, je vois mon tag, mais je ne le vois pas dans "Mon site - Tags et notes".Tags non vus dans Mon site après l'avoir ajouté en utilisant l'API
protected override void CreateChildControls()
{
Control control = Page.LoadControl(_ascxPath);
Controls.Add(control);
Literal lt = new Literal();
SPServiceContext objServiceContext = SPServiceContext.Current;
SocialTagManager objSocialTagManager = new SocialTagManager(objServiceContext);
try
{
TermStore objTermStore = objSocialTagManager.TaxonomySession.DefaultKeywordsTermStore;
Term objTerm = objTermStore.KeywordsTermSet.CreateTerm("I Like Iting", objTermStore.DefaultLanguage);
System.Uri objURI = new Uri("http://spdev01/Lists/Calendar/calendar.aspx");
SocialTag objTag = objSocialTagManager.AddTag(objURI, objTerm, "Calendar YoYo");
lt.Text = objTag.Url.ToString() + objTag.Term.Name + "<br/><br/>";
}
catch (Exception ex)
{
lt.Text = ex.Message + ex.StackTrace + "<br/>";
}
finally
{
Controls.Add(lt);
}
//Display all the tags
string myaccount = @"domain\sharepoint";
UserProfileManager objUPManager = new UserProfileManager(objServiceContext);
UserProfile objProfile = objUPManager.GetUserProfile(myaccount);
SocialTag[] allTags = objSocialTagManager.GetTags(objProfile);
Literal ltTags = new Literal();
foreach (SocialTag tag in allTags)
ltTags.Text += string.Format("Tag: {0} - URL: {1}<br/>", tag.Term.Name, tag.Url.ToString());
Controls.Add(ltTags);
}
je ne vois pas l'étiquette personnalisée dans « Mon site » mais je vois quand je boucle à travers la propriété « MyTags ». Dois-je exécuter un travail spécifique pour le voir sous "Mon site"?