title: Azure AD Graph API add member to group
body: <p>I am trying to add a member to a group using the aad graph api and I am keep getting 404.
  A similar code works for me when I am trying to get the group members.
  This is the code:</p>
  
  <pre><code>string requestUrl = string.Format("https://graph.windows.net/{0}/groups/{1}/$linkes/members?api-version=2013-04-05", tenantName, group.ObjectId);
  
  string postData = string.Format("\"url\":\"https://graph.windows.net/{0}/users/{1}?api-version=2013-04-05\"", tenantName, user.ObjectId);
  
  HttpWebRequest webRequest = WebRequest.Create(requestUrl) as HttpWebRequest;
  webRequest.Method = "POST";
  webRequest.Headers["Authorization"] = authenticationResult.CreateAuthorizationHeader();
  webRequest.ContentType = "application/json"; //"application/x-www-form-urlencoded"; 
  webRequest.Host = "graph.windows.net";
  webRequest.ContentLength = postData.Length;
  
  byte[] byteArray = Encoding.UTF8.GetBytes(postData);
  using (Stream dataStream = webRequest.GetRequestStream())
  {
      dataStream.Write(byteArray, 0, byteArray.Length);
  }
  
  string jsonText;
  var httpResponse = (HttpWebResponse)webRequest.GetResponse();
  using (var streamReader =
         new StreamReader(httpResponse.GetResponseStream()))
  {
      jsonText = streamReader.ReadToEnd();
  }
  </code></pre>
  
  <p>I know there are other ways to do the same work, for example using the graph connection, but I prefer to use this way because it should work for roles as well.
  Thanks</p>