private WebPartEntity CreateYammerWebPart(string feedType, YammerUser user, string yammerGroupName, string title) { YammerGroup group; string groupId; // Notice that in general we do not recommend of matching Yammer group for each site to avoid "group pollution" in Yammer if (feedType == "Group") { // Get Yammer Group - Creates if does not exist. Let's create these as public by default. group = YammerUtility.CreateYammerGroup(yammerGroupName, false, ConfigurationManager.AppSettings["YammerAccessToken"]); // Get Yammer web part return(YammerUtility.GetYammerGroupDiscussionPart(user.network_name, group.id, false, false)); } else { if (!string.IsNullOrEmpty(YammerExistingGroups.SelectedValue)) { group = YammerUtility.GetYammerGroupByName(YammerExistingGroups.SelectedValue, ConfigurationManager.AppSettings["YammerAccessToken"]); groupId = group.id.ToString(); } else { groupId = ""; } // Get OpenGrap object for using that as the discussion feed return(YammerUtility.GetYammerOpenGraphDiscussionPart(user.network_name, Request["SPHostUrl"] + "/" + txtUrl.Text, false, false, "SharePoint Site Feed - " + title, "", groupId)); } }
static void Main(string[] args) { // Simple tester console to ensure that token works as expected. Details on getting token from here - https://developer.yammer.com/authentication string accessToken = "GetYourOwnAccessTokenFromYammer"; YammerGroup group = YammerUtility.GetYammerGroupByName("fuu", accessToken); }