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 摘要。