Console application .Net 7.0 with DI User with authentication "App-only access (access without a user)"
Upload file to default site of SharePoint Site (Shared Documents), and then download it.
recording-2023-03-13-16-51-44.webm
recording-2023-03-13-16-58-44.webm
string[] scopes = { "https://graph.microsoft.com/.default" };
ClientSecretCredential clientSecretCredential =
new(
"695cecd9-6b4e057a....", // TENANT ID
"267a56e2-cbe82623.....", // CLIENT ID
"BbJ8Q~Ttv8lMxYIs.....", // SECRET
new() { AuthorityHost = AzureAuthorityHosts.AzurePublicCloud }
);
GraphServiceClient graphClient = new(clientSecretCredential, scopes);
await graphClient.Drives[id!.Id].Root
.ItemWithPath("Hack Together Microsoft Graph and .NET Calendar.ics")
.Content.PutAsync(stream, null, new CancellationToken());