Created
June 3, 2022 09:20
-
-
Save rohit-lakhanpal/0fb9b28b18b676a7146a43e84197abd6 to your computer and use it in GitHub Desktop.
Read the properties and relationships of an acronym object using Microsoft Graph (beta).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // using Azure.Identity; | |
| // using Microsoft.Graph.Beta; | |
| // Create an Azure App Registration with the following API permissions: | |
| // - https://graph.microsoft.com/SearchConfiguration.Read.All | |
| // - https://graph.microsoft.com/SearchConfiguration.ReadWrite.All | |
| string clientId = ""; | |
| string clientSecret = ""; | |
| string tenantId = ""; | |
| var scopes = new[] { "https://graph.microsoft.com/.default" }; | |
| var options = new TokenCredentialOptions | |
| { | |
| AuthorityHost = AzureAuthorityHosts.AzurePublicCloud | |
| }; | |
| var clientSecretCredential = new ClientSecretCredential( | |
| tenantId, clientId, clientSecret, options); | |
| var graphClient = new GraphServiceClient(clientSecretCredential, | |
| scopes); | |
| var acronyms = await graphClient.Search.Acronyms.GetAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment