【问题标题】:How post messages to the yammer private group如何将消息发布到 yammer 私人组
【发布时间】:2014-08-28 03:04:55
【问题描述】:

我可以使用此链接从 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);
    }

【问题讨论】:

    标签: windows-phone-8 yammer


    【解决方案1】:

    如下所示构建您的帖子网址,并使用 Bearer 令牌格式将身份验证保留在标题中。

    请注意,正文以 post 格式包装在查询中。

    auth = "持有者" + 令牌

    HTTParty.post("https://www.yammer.com/api/v1/messages.json?group_id=3248147",
                  { 
                    :headers => { "Authorization" => auth},
                    :query => {"body" => 'hello' }
      })
    

    【讨论】:

    • 另外,请确保应用程序/令牌帐户在私有组中。
    猜你喜欢
    • 2012-12-16
    • 2017-09-02
    • 1970-01-01
    • 2016-09-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-25
    • 1970-01-01
    • 2018-01-30
    相关资源
    最近更新 更多