I am trying to Tag a Url with the "I Like It" using code, i.e. using the SocialTagManager class.
SPServiceContext serviceContext = SPServiceContext.GetContext(SPContext.Current.Site);
SocialTagManager socialTagManager = new SocialTagManager(serviceContext);
UserProfileManager userProfileManager = new UserProfileManager(serviceContext);
UserProfile userProfile = userProfileManager.GetUserProfile(CurrentUser);
SocialTerm[] terms = socialTagManager.GetTerms(userProfile);
Term favTerm = (from t in terms
where (t.Term.Name.Equals("i like it", StringComparison.InvariantCultureIgnoreCase))
select t.Term).First();
socialTagManager.AddTag(new Uri(Url), favTerm, Title);
But for this, the favTerm should be already there in SharePoint. But if a user has not tagged any page with "I Like it" before then the GetTerms() or GetAllTerms() method does not return any Term for I Like it.
How do I create a new Term if the I Like it Term is not already there?
Thanks in advance