Esempio n. 1
0
 public async Task<List<GroupModel>> SearchGoupByName(string groupName)
 {
     var allGroup = new List<GroupModel>();
     string restURL = string.Format("{0}/myorganization/groups?$filter=startswith(displayName,'{1}')", GraphBetaResourceUrl, groupName);
     string responseString = await GetJsonAsync(restURL);
     if (responseString != null)
     {
         var jsonresult = JObject.Parse(responseString)["value"];
         foreach (var item in jsonresult)
         {
             var group = new GroupModel
             {
                 Id = item["id"].IsNullOrEmpty() ? string.Empty : item["id"].ToString(),
                 displayName = item["displayName"].IsNullOrEmpty() ? string.Empty : item["displayName"].ToString()
             };
             allGroup.Add(group);
         }
     }
     return allGroup;
 }
Esempio n. 2
0
 public async Task<List<GroupModel>> GetMyOrganizationGroups()
 {
     var allGroup = new List<GroupModel>();
     string restURL = string.Format("{0}/myorganization/groups?$select=id,displayName", GraphResourceUrl);
     string responseString = await GetJsonAsync(restURL);
     if (responseString != null)
     {
         var jsonresult = JObject.Parse(responseString)["value"];
         foreach (var item in jsonresult)
         {
             var group = new GroupModel
             {
                 Id = item["id"].IsNullOrEmpty() ? string.Empty : item["id"].ToString(),
                 displayName = item["displayName"].IsNullOrEmpty() ? string.Empty : item["displayName"].ToString()
             };
             allGroup.Add(group);
         }
     }
     return allGroup;
 }
 public async Task<List<GroupModel>> GetJoinedGroups()
 {
     var allGroup = new List<GroupModel>();
     string restURL = string.Format("{0}/me/memberOf", GraphResourceUrl);
     string responseString = await GetJsonAsync(restURL);
     if (responseString != null)
     {
         var jsonresult = JObject.Parse(responseString)["value"];
         foreach (var item in jsonresult)
         {
             if (item["@odata.type"].ToString().Equals("#microsoft.graph.group", StringComparison.CurrentCultureIgnoreCase))
             {
                 var group = new GroupModel
                 {
                     Id = item["id"].IsNullOrEmpty() ? string.Empty : item["id"].ToString(),
                     displayName = item["displayName"].IsNullOrEmpty() ? string.Empty : item["displayName"].ToString()
                 };
                 allGroup.Add(group);
             }
         }
     }
     return allGroup;
 }