msgraph-sdk-dotnet
msgraph-sdk-dotnet copied to clipboard
Microsoft Graph Search API using Azure key vault?
Hi.
How can I use the Microsoft Graph search API using C# to connect via Azure Key Vault?
(I want to be able to search email messages)
Is the a C# sample I can look at.
Thanks Ward
Thanks for raising this @ward-horsfall
You can perform a search query with an example as below in line with the documentation at https://learn.microsoft.com/en-us/graph/search-concept-messages
var searchRequests = new List<SearchRequestObject>
{
new SearchRequestObject
{
EntityTypes = new List<EntityType>
{
EntityType.Message
},
Query = new SearchQuery
{
QueryString = "contoso"
},
From = 0,
Size = 25
}
};
await graphClient.Search
.Query(searchRequests)
.Request()
.PostAsync();
With regards to Azure KeyVault, are you looking to just fetch a secret from it?
Hi andrueastman,
Thanks for your response.
Yes correct it is how to fetch a secure from it (via Azure KeyVault).
After that then make a connection to it - to create an instance of graphClient that I can use in your example.
Thanks again,
Ward