microsoftgraph / microsoftgraph/msgraph-sdk-java

Workbooks: Update range of a worksheet not implemented in sdk

未关闭
#2,202 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

type:feature
主要语言
Java
星标
444
派生
154
平均合并
18 小时 28 分钟
30 天内合并 PR
4

描述

Is your feature request related to a problem? Please describe the problem.

I want to update a range within a worksheet and noticed that the update range endoint (PATCH /drive/items/{id}/workbook/worksheets/{sheet-id}/range(address='A1:B2')) cannot be called via the msgraph-sdk for java.

API Docs:
https://learn.microsoft.com/en-us/graph/api/range-update?view=graph-rest-1.0&tabs=http

SDK-Version: 6.18.0

Describe the solution you'd like.

I would be glad if you could extend the sdk to support this functionality.

E.g. something like this:

myGraphServiceClient
          .drives()
          .byDriveId(driveId)
          .items()
          .byDriveItemId(documentId)
          .workbook()
          .worksheets()
          .byWorkbookWorksheetId(worksheet)
          .rangeWithAddress(address)
          .patch(patchRequest);
Additional context?

My current workaround is

final var updateRangeRequest = new UntypedObject(Map.of(
    "values", new UntypedArray(Arrays.asList(
      new UntypedArray(Arrays.asList(
        new UntypedString(value)
      ))
    ))
  ));


  final var requestInfo = graphServiceClient
    .drives()
    .byDriveId(this.driveId)
    .items()
    .byDriveItemId(documentId)
    .workbook()
    .worksheets()
    .byWorkbookWorksheetId(worksheet)
    .rangeWithAddress(address)
    .toGetRequestInformation();

// Convert the get-request to the desired patch
  requestInfo.headers.tryAdd("workbook-session-id", sessionId);
  requestInfo.httpMethod = HttpMethod.PATCH;
  requestInfo.setContentFromParsable(graphServiceClient.getRequestAdapter(), "application/json", updateRangeRequest);

// Copied from sdk
  HashMap<String, ParsableFactory<? extends Parsable>> errorMapping = new HashMap();
  errorMapping.put("XXX", ODataError::createFromDiscriminatorValue);
  
  final var updatedRange = (WorkbookRange) graphServiceClient.getRequestAdapter()
    .send(requestInfo, errorMapping, WorkbookRange::createFromDiscriminatorValue);

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从以 worksheets().byWorkbookWorksheetId(worksheet).rangeWithAddress(address) 结尾的 Java SDK 入口点开始,并将其与范围更新 API 文档进行比较。验证现有请求信息的构建方式,以及所提供的 PATCH payload 的发送方式;当调用方可以通过正常的 SDK 路径而不是 workaround 更新 worksheet 范围时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api, developer-experience
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。