コード例 #1
0
        public void PostMessage(String messageContent)
        {
            YammerRequest yr = this.CreateRequest();

            yr.EndPoint = YammerEndPoint.Messages;

            String contentString = @"
{
  ""body"": """ + messageContent + @"""                
}
";

            yr.Method      = "POST";
            yr.ContentType = "application/json";
            yr.BeginInit();

            Stream content = yr.GetRequestStream();

            using (StreamWriter sw = new StreamWriter(content))
            {
                sw.Write(contentString);
            }

            Stream responseStream = yr.GetResponseStream();

            StreamReader sr = new StreamReader(responseStream);

            String body = sr.ReadToEnd();
        }
コード例 #2
0
        public void PostActivity(Activity activity)
        {
            YammerRequest yr = this.CreateRequest();

            yr.EndPoint = YammerEndPoint.Activity;

            ActivityUpdate au = new ActivityUpdate();

            au.Activity = activity;

            yr.Method      = "POST";
            yr.ContentType = "application/json";
            yr.BeginInit();

            Stream content = yr.GetRequestStream();

            DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ActivityUpdate), this.Settings);

            serializer.WriteObject(content, au);



            Stream responseStream = yr.GetResponseStream();

            StreamReader sr = new StreamReader(responseStream);

            String body = sr.ReadToEnd();
        }
コード例 #3
0
        public MessageSet GetMessages(YammerEndPoint endPoint, MessageThreading threading, int?limit, int?olderThan, int?newerThan)
        {
            MessageSet msgs = null;

            YammerRequest yr = this.CreateRequest();

            yr.EndPoint = endPoint;
            yr.BeginInit();

            using (Stream s = yr.GetResponseStream())
            {
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(MessageSet), this.Settings);

                msgs = serializer.ReadObject(s) as MessageSet;

                if (msgs != null)
                {
                    msgs.YammerContext = this;

                    foreach (Message m in msgs.Messages)
                    {
                        m.YammerContext = this;
                    }
                }
            }

            return(msgs);
        }
コード例 #4
0
        public YammerRequest CreateRequest()
        {
            YammerRequest yr = new YammerRequest(this);

            return yr;
        }
コード例 #5
0
        public YammerRequest CreateRequest()
        {
            YammerRequest yr = new YammerRequest(this);

            return(yr);
        }