protected override WebRequest GetWebRequest(Uri uri) { var request = base.GetWebRequest(uri); //Add the Accept-Language header (for Danish) in the request. string[] scopes = { "Sites.Read.All", "Sites.ReadWrite.All", "Sites.FullControl.All", "Sites.Manage.All", "Mail.Send", "Reports.Read.All", "Group.ReadWrite.All", "Directory.Read.All", "User.Read.All", "Files.Read.All", "IdentityProvider.Read.All", "offline_access", }; var accessToken = new GraphClientConfig().GetToken(new Connection(), scopes).Result; request.Headers.Add("Authorization", $"Bearer {accessToken}"); return(request); }
public GraphClient(GraphClientConfig graphClientConfig) { GraphClientConfig = graphClientConfig; }