Ejemplo n.º 1
0
        public async Task <List <ConversationModel> > GetGroupConversations(string id)
        {
            var    retconversations = new List <ConversationModel>();
            string restURL          = string.Format("{0}/{1}/groups/{2}/conversations?$select=id,topic,preview,lastDeliveredDateTime", GraphResourceUrl, TenantId, id);
            string responseString   = await GetJsonAsync(restURL);

            if (responseString != null)
            {
                var jsonresult = JObject.Parse(responseString)["value"];
                foreach (var item in jsonresult)
                {
                    var conversation = new ConversationModel
                    {
                        Id      = item["id"].IsNullOrEmpty() ? string.Empty : item["id"].ToString(),
                        topic   = item["topic"].IsNullOrEmpty() ? string.Empty : item["topic"].ToString(),
                        preview = item["preview"].IsNullOrEmpty() ? string.Empty : item["preview"].ToString(),
                        lastDeliveredDateTime = item["lastDeliveredDateTime"].IsNullOrEmpty() ? new DateTime() : DateTime.Parse(item["lastDeliveredDateTime"].ToString())
                    };
                    retconversations.Add(conversation);
                }
            }
            return(retconversations);
        }
Ejemplo n.º 2
0
 public async Task<List<ConversationModel>> GetGroupConversations(string id)
 {
     var retconversations = new List<ConversationModel>();
     string restURL = string.Format("{0}/myorganization/groups/{1}/conversations?$select=id,topic,preview,lastDeliveredDateTime", GraphResourceUrl, id);
     string responseString = await GetJsonAsync(restURL);
     if (responseString != null)
     {
         var jsonresult = JObject.Parse(responseString)["value"];
         foreach (var item in jsonresult)
         {
             var conversation = new ConversationModel
             {
                 Id = item["id"].IsNullOrEmpty() ? string.Empty : item["id"].ToString(),
                 topic = item["topic"].IsNullOrEmpty() ? string.Empty : item["topic"].ToString(),
                 preview = item["preview"].IsNullOrEmpty() ? string.Empty : item["preview"].ToString(),
                 lastDeliveredDateTime = item["lastDeliveredDateTime"].IsNullOrEmpty() ? new DateTime() : DateTime.Parse(item["lastDeliveredDateTime"].ToString())
             };
             retconversations.Add(conversation);
         }
     }
     return retconversations;
 }