我可以使用此链接从 yammer 私人组获取消息 https://www.yammer.com/api/v1/messages/in_group/3248147.json?access_token= + rawtoken)
但我使用相同的链接将消息发布到 yammer 中的私人组,为此我编写了以下代码。但它仅表现为 get 方法,我无法将消息发布到私人组。
WebClient wc = new System.Net.WebClient();
Uri uri = new Uri("https://www.yammer.com/api/v1/messages/in_group/3248147.json?access_token=" + rawtoken);
student ns = new student();
// wc.Headers["Authorization"] = "Bearer" + rawtoken; //use discoEN token here
// String data1 = "group-id=" + ns.group_id + "&body=" + ns.body;
String data = "body=" + "hello";
wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted);
wc.Headers["Content-Type"] = "application/x-www-form-urlencoded";
wc.Encoding = Encoding.UTF8;
wc.UploadStringTaskAsync(uri,"post",data);
private void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
{
MessageBox.Show(e.Result);
}