דמו 1
דמו 1

Reputation: 13

Connecting to yammer api in C#

I want to connect to yammer with OAuth 2 Server & Client-Side Flow . I read it in the https://developer.yammer.com/docs/oauth-2 site but I didn't understated how to do it in C#

Can some body give me the code in c# that makes the connection .

Upvotes: 1

Views: 1647

Answers (1)

Shep
Shep

Reputation: 628

            string bearer = 'abcdefrg234'
            string url = "https://www.yammer.com/api/v1/groups/"; // any endpoint
            HttpWebRequest request;
            request = (HttpWebRequest)WebRequest.Create(url);
            request.Headers.Add("Authorization", "Bearer " + bearer);
            request.Timeout = 90000;
            request.Proxy = new WebProxy() { UseDefaultCredentials = true };
            using (WebResponse response = (HttpWebResponse)request.GetResponse())
            {
                using (Stream responseStream = response.GetResponseStream())
                {
                    XDocument XMLDoc = XDocument.Load(responseStream);
                   //To Do: use XMLDoc
                 }
            }

Upvotes: 1

Related Questions