I recently started using the Office 365 API and can now successfully authenticate and get a token. Now I want to query the user's Exchange for meetings. To do this I run the example query from here:
var client = new OutlookServicesClient(new Uri("https://outlook.office.com/api/2.0"), async () =>
{
// Since we have it locally from the Session, just return it here.
return token;
});
var eventResults = await client.Me.Events.OrderByDescending(e => e.Start).Take(10).Select(e => new DisplayEvent(e.Subject, e.Start.ToString(), e.End.ToString())).ExecuteAsync();
// query: https://outlook.office.com/api/2.0/Me/Events?$orderby=Start%%20desc&$top=10&$select=Subject,Start,End
Unfortunately, this returns the following error (500): Server Error in '/API' Application. Constructor on type 'Microsoft.Exchange.Services.OData.Web.HttpHandler' not found.
Googling around, I found some similar errors (here and here). It seemed there was an issue with the server at that time. However, as the API is pretty mature, I assume I am doing something wrong, rather than a server error.
Edit: Testing the query on https://oauthplay.azurewebsites.net/ also results in the same error, while the example queries work.
Does someone have any idea what I am doing wrong?
It turns out there is a typo in the .NET getting started calendar code that uses a bad URI for the constructor of the OutlookServicesClient
object. That line should read:
OutlookServicesClient client = new OutlookServicesClient(
new Uri("https://outlook.office.com/api/v2.0"),
The sample was missing the v
in the URI, which was causing the error.
来源:https://stackoverflow.com/questions/34163445/constructor-of-type-httphandler-not-found-using-the-office-365-api