Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public static async Task<Users> searchUsers(string token, string search)
  2. {
  3. string query = String.Format("https://graph.microsoft.com/v1.0/users?$filter=startswith(displayname,'{0}') or startswith(surname,'{1}')", search, search);
  4. string users = null;
  5. httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
  6. HttpResponseMessage response = httpClient.GetAsync(query).Result;
  7. users = response.Content.ReadAsStringAsync().Result;
  8. Users usersJson = JsonConvert.DeserializeObject<Users>(users);
  9. return usersJson;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement