Skip to content

Instantly share code, notes, and snippets.

@rohit-lakhanpal
Created June 3, 2022 09:20
Show Gist options
  • Select an option

  • Save rohit-lakhanpal/0fb9b28b18b676a7146a43e84197abd6 to your computer and use it in GitHub Desktop.

Select an option

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).
// 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