I have created an auth provider using user-password auth provider but and trying to retrieve calendar events in bot code which is in c#, having bot framework 4
IPublicClientApplication publicClientApplication =
PublicClientApplicationBuilder
.Create("jhnjchdjvd")
.WithTenantId("sdfdf")
.Build();
var s = new SecureString();
s.AppendChar('<');
s.AppendChar('T');
s.AppendChar('N');
s.AppendChar('>');
s.AppendChar('7');
UsernamePasswordProvider authProvider = new UsernamePasswordProvider(publicClientApplication, scopes);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
Microsoft.Graph.User me = await graphClient.Me.Request()
.WithUsernamePassword("[email protected]",
s).GetAsync();
var events = await graphClient.Me.Events
.Request()
.Header("Prefer", "outlook.timezone=\"Pacific Standard Time\"")
.Select(e => new
{
e.Subject,
e.Body,
e.BodyPreview,
e.Organizer,
e.Attendees,
e.Start,
e.End,
e.Location
})
.GetAsync();
Above code throws exception which is
Microsoft.graph.serviceexception code generalexceptionmessage an error occurred sending the request
How can I solve this error?
"Install-Package Microsoft.Identity.Client -Pre". This command installs latest MSAL library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With