Skip to content

sergiokml/Hack-2gether

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hack-2gether

Introduction

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.

Step 1 : Register the app in Azure with a "basic" user of AD organization.
recording-2023-03-13-16-51-44.webm
Step 2 : Apply "Admin consent required" with the "admin" user of AD organization.
recording-2023-03-13-16-58-44.webm
Step 3 : Login through the console application:
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);
Step 4 : Callig Api Graph:
await graphClient.Drives[id!.Id].Root
           .ItemWithPath("Hack Together Microsoft Graph and .NET Calendar.ics")
           .Content.PutAsync(stream, null, new CancellationToken());

Hack Together: Microsoft Graph and .NET

Releases

No releases published

Packages

No packages published

Languages