小编Jan*_*use的帖子

在ASP.Net Core Web API中返回文件

问题

我想在我的ASP.Net Web API Controller中返回一个文件,但我的所有方法都返回HttpResponseMessage为JSON.

代码到目前为止

public async Task<HttpResponseMessage> DownloadAsync(string id)
{
    var response = new HttpResponseMessage(HttpStatusCode.OK);
    response.Content = new StreamContent({{__insert_stream_here__}});
    response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
    return response;
}
Run Code Online (Sandbox Code Playgroud)

当我在浏览器中调用此端点时,Web API会返回设置HttpResponseMessage为HTTP Content Header 的as JSON application/json.

c# .net-core asp.net-core asp.net-core-webapi

98
推荐指数
4
解决办法
9万
查看次数

图谱API:PUT/beta/groups/<groupId> /团队验证错误

问题

PUT请求/beta/groups/<groupId>/team失败,并出现以下错误:

{
    "error": {
        "code": "AuthenticationError",
        "message": "Error authenticating with resource.",
        "innerError": {
            "request-id": "e4385864-85e4-4fa6-8878-458988c584e4",
            "date": "2017-11-10T10:29:39"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

提供了一个Bearer令牌,它是通过使用委托权限生成的Group.ReadWrite.All.

端点记录在此处.

到目前为止我找到的东西

看起来,它与团队资源有关.以下请求不起作用:

  • PUT /beta/group/<groupId>/team
  • GET /beta/me/joinedTeams

两者都失败了AuthenticationError.

更新

/beta/group/<groupId>/team 现在工作.

microsoft-graph microsoft-teams

5
推荐指数
1
解决办法
569
查看次数