【问题标题】:Onenote API failureOnenote API 失败
【发布时间】:2016-01-27 01:09:57
【问题描述】:

我在尝试获取网站集和网站 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
  }
}

【问题讨论】:

    标签: onenote onenote-api


    【解决方案1】:

    如果这是一个逐字代码 sn-p,看起来您缺少 url 参数的右括号。

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

    【讨论】:

      【解决方案2】:

      看起来您可能缺少与身份验证相关的标头。

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

      【讨论】:

      • 我有以下 3 项授权 APP 1. 在 onenote 笔记本中创建页面 2. 查看和修改 onenote 笔记本 3.查看和修改您组织中的 onenote 笔记本
      • 我需要提供任何其他权限吗?
      • 如果您使用了错误的范围,API 会在 JSON 有效负载中通知您。能否分享一下 HTTP 响应中 X-CorrelationId 标头的值?
      • 我们是否获得了此调用的 X-Correlation Id。我没有看到它。这是我在 Jason 解析 "{\r\n \"error\":{\r\n \"code\":\"20143\",\"message\":\"OData 查询时看到的错误是无效的。错误请求 - 查询语法错误。\",\"@api.url\":\"aka.ms/onenote-errors#C20143\"\r\n }\r\n}"
      • 您好 Jorge,我错过了通话中的括号。现在它起作用了。非常感谢您的帮助。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-30
      • 1970-01-01
      相关资源
      最近更新 更多