在没有用户的情况下创建会话

时间:2019-09-23 02:10:59

标签: microsoft-graph

我想在没有用户的情况下创建会话。 (本机应用程序)

get an access token很好。
但是我不能create session

代码:

public Mono<ServerResponse> getEntity(ServerRequest request) {
    String entityId = request.pathVariable("id");
    Mono<MyEntity> entity = service.findEntity(entityId);
    String headerValue = "???" // The header value depends on the values of the entity, which is not present at this point, here I only have access to the Mono 
    return ok().header("my-header", headerValue)
        .contentType(MediaType.APPLICATION_JSON)
        .body(entity , MyEntity.class);
  }

错误:

using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, $"https://graph.microsoft.com/v1.0/me/drive/items/8C353AA80F001A1F!350000/workbook/createSession");
request.Headers.Add("authorization", "Bearer " + accessToken);
request.Content = new StringContent("{ \"persistChanges\": true }", Encoding.UTF8, "application/json");

你能告诉我如何解决的想法吗?

相关问题