Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workbooks: Update range of a worksheet not implemented in sdk #2202

Open
lombold opened this issue Oct 17, 2024 · 0 comments
Open

Workbooks: Update range of a worksheet not implemented in sdk #2202

lombold opened this issue Oct 17, 2024 · 0 comments
Labels
type:feature New experience request

Comments

@lombold
Copy link

lombold commented Oct 17, 2024

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);
@lombold lombold added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:feature New experience request labels Oct 17, 2024
@timayabi2020 timayabi2020 removed the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New experience request
Projects
None yet
Development

No branches or pull requests

2 participants