Onenote API 失败

Onenote API failure

我在尝试获取网站集和网站 ID 时遇到以下错误。可能是什么原因?任何帮助将非常感激。

var getMessage = new HttpRequestMessage(HttpMethod.Get, "https://www.onenote.com/api/beta/myorganization/siteCollections/FromUrl(url='https://123.sharepoint.com/teams/techs'");

{
  StatusCode: 400,
  ReasonPhrase: 'Bad Request',
  Version: 1.1,
  Content: System.Net.Http.StreamContent,
  Headers: {
    OData - Version: 4.0 Cache - Control: private Server: Microsoft - IIS / 8.5 X - AspNet - Version: 4.0.30319 X - Powered - By: ASP.NET X - Powered - By: ASP.NET Date: Sun, 17 Jan 2016 19: 59: 05 GMT Content - Length: 168 Content - Type: application / json;
    charset = utf - 8;
    odata.metadata = minimal;
    odata.streaming = true;
    IEEE754Compatible = false
  }
}

看起来你可能错过了 authentication-related headers.

http://blogs.msdn.com/b/onenotedev/archive/2015/06/11/and-sharepoint-makes-three.aspx

如果这是逐字记录的代码片段,那么您似乎缺少 url 参数的右括号。

var getMessage = new HttpRequestMessage(HttpMethod.Get, "https://www.onenote.com/api/beta/myorganization/siteCollections/FromUrl(url='https://123.sharepoint.com/teams/techs')");