使用 Office 365 API 未找到 HttpHandler 类型的构造函数 [英] Constructor of type HttpHandler not found using the Office 365 API

查看:27
本文介绍了使用 Office 365 API 未找到 HttpHandler 类型的构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用 Office 365 API,现在可以成功 验证并获得令牌.现在我想查询用户的 Exchange 会议.为此,我从 here 运行示例查询:

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  

不幸的是,这会返回以下错误 (500):/API"应用程序中的服务器错误.找不到类型Microsoft.Exchange.Services.OData.Web.HttpHandler"的构造函数.

Unfortunately, this returns the following error (500): Server Error in '/API' Application. Constructor on type 'Microsoft.Exchange.Services.OData.Web.HttpHandler' not found.

谷歌搜索,我发现了一些类似的错误(这里这里).当时似乎服务器有问题.但是,由于 API 相当成熟,我认为我做错了什么,而不是服务器错误.

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.

编辑:在 https://oauthplay.azurewebsites.net/上测试查询/a> 也会导致相同的错误,而示例查询有效.

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?

推荐答案

原来.NET 入门 日历代码对 OutlookServicesClient 对象的构造函数使用了错误的 URI.该行应为:

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"),

示例在 URI 中缺少 v,这是导致错误的原因.

The sample was missing the v in the URI, which was causing the error.

这篇关于使用 Office 365 API 未找到 HttpHandler 类型的构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆