Пример #1
0
        public async Task <List <ThreadModel> > GetGroupThreads(string id)
        {
            var    retthreads     = new List <ThreadModel>();
            string restURL        = string.Format("{0}/{1}/groups/{2}/threads?$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 thread = new ThreadModel
                    {
                        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())
                    };
                    retthreads.Add(thread);
                }
            }
            return(retthreads);
        }
Пример #2
0
 public async Task<List<ThreadModel>> GetGroupThreads(string id)
 {
     var retthreads = new List<ThreadModel>();
     string restURL = string.Format("{0}/myorganization/groups/{1}/threads?$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 thread = new ThreadModel
             {
                 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())
             };
             retthreads.Add(thread);
         }
     }
     return retthreads;
 }