2025-04-09 08:22:32 +02:00
|
|
|
---
|
|
|
|
created: 2024-09-09T09:33
|
2025-05-01 10:04:40 +02:00
|
|
|
updated: 2025-05-01T10:04
|
2025-04-09 08:22:32 +02:00
|
|
|
---
|
2024-09-08 09:16:06 +02:00
|
|
|
|
|
|
|
email koopernikus@web.de
|
|
|
|
|
|
|
|
telefonnummer 01607851441
|
|
|
|
|
2024-09-08 09:16:28 +02:00
|
|
|
URL
|
2024-09-08 09:21:24 +02:00
|
|
|
https://claude.ai
|
|
|
|
|
2025-01-13 20:30:46 +01:00
|
|
|
Was war das nochmal ?
|
2024-09-08 09:21:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
using Microsoft.Graph;
|
|
|
|
using Microsoft.Identity.Client;
|
|
|
|
|
|
|
|
// ... (in Ihrer Funktionsmethode)
|
|
|
|
|
|
|
|
var clientId = Environment.GetEnvironmentVariable("CLIENT_ID");
|
|
|
|
var clientSecret = Environment.GetEnvironmentVariable("CLIENT_SECRET");
|
|
|
|
var tenantId = Environment.GetEnvironmentVariable("TENANT_ID");
|
|
|
|
|
|
|
|
var confidentialClientApplication = ConfidentialClientApplicationBuilder
|
|
|
|
.Create(clientId)
|
|
|
|
.WithClientSecret(clientSecret)
|
|
|
|
.WithAuthority(new Uri($"https://login.microsoftonline.com/{tenantId}/v2.0"))
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
var scopes = new[] { "https://graph.microsoft.com/.default" };
|
|
|
|
|
|
|
|
var authResult = await confidentialClientApplication.AcquireTokenForClient(scopes).ExecuteAsync();
|
|
|
|
|
|
|
|
var graphClient = new GraphServiceClient(new DelegateAuthenticationProvider(async (request) =>
|
|
|
|
{
|
|
|
|
request.Headers.Authorization = new HeaderStringValues($"Bearer {authResult.AccessToken}");
|
|
|
|
}));
|
|
|
|
|
|
|
|
// Beispiel für einen Graph-API-Aufruf
|
|
|
|
var user = await graphClient.Users["user@example.com"].Request().GetAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-08 09:22:33 +02:00
|
|
|
#befehle #konto #Account #programmieren #code
|
2025-01-13 20:43:05 +01:00
|
|
|
|