Skip to content

Specified range is not being pull in worksheet in graph api. #1063

Closed
microsoftgraph/MSGraph-SDK-Code-Generator
#857

Description

Expected behavior

API /me/drive/items/{id}/workbook/worksheets/{id|name}/range(address='

') should give range for given address.

Actual behavior

API /me/drive/items/{id}/workbook/worksheets/{id|name}/range(address='

') giving full range of worksheet.

Steps to reproduce the behavior

execute API: /me/drive/items/{id}/workbook/worksheets/{id|name}/range(address='

') with proper input in java sdk.

Activity

  1. ramsessanchez commented on Apr 28, 2022

    @ramsessanchez
    Contributor
  2. filip-jaksic commented on Aug 18, 2022

    @filip-jaksic

    Hello, we are facing the same issue. Namely, that the "GetRange" endpoint doesn't respect the given address/range.

    The endpoint works normally when used in Graph Explorer or with plain HTTP requests in Java, but when we use the GraphAPI-Java-SDK in the same way, it doesn't work. Or to be more precise, it does the same action as if a blank string "" was entered for the address of the range.

    Also, we can confirm that there exists a bug in the original GraphAPI-Java-SDK code for which Gaurav Baranwal (@BaranwalG) submitted a fix. Namely, without his fix it misses to actually use the address field of the range and that's why each GetRange request has the same response as if one didn't enter any address for it. To be more concrete, without his fix the address, which is stored in the "functionOptions" field, never gets added to the actual HTTP request. The relevant code in question:

    public WorkbookWorksheetRangeRequestBuilder(@Nonnull final String requestUrl, @Nonnull final IBaseClient<?> client, @Nullable final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions, @Nonnull final WorkbookWorksheetRangeParameterSet parameters) {
    super(requestUrl, client, requestOptions);
    if(parameters != null) {
    functionOptions = parameters.getFunctionOptions();
    }
    }
    /**
    * Creates the WorkbookWorksheetRangeRequest
    *
    * @param requestOptions the options for the request
    * @return the WorkbookWorksheetRangeRequest instance
    */
    @Nonnull
    public WorkbookWorksheetRangeRequest buildRequest(@Nullable final com.microsoft.graph.options.Option... requestOptions) {
    return buildRequest(getOptions(requestOptions));
    }
    /**
    * Creates the WorkbookWorksheetRangeRequest with specific requestOptions instead of the existing requestOptions
    *
    * @param requestOptions the options for the request
    * @return the WorkbookWorksheetRangeRequest instance
    */
    @Nonnull
    public WorkbookWorksheetRangeRequest buildRequest(@Nonnull final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) {
    final WorkbookWorksheetRangeRequest request = new WorkbookWorksheetRangeRequest(
    getRequestUrl(),
    getClient(),
    requestOptions);
    return request;
    }

    Java code which can be used to see that providing an address for the GetRange endpoint doesn't do anything in the GraphAPI-Java-SDK, i.e. the address gets ignored:

         var valueOfA1 = _graphApiClient
                 .drives(DRIVE_ID)
                 .items(ITEM_ID)
                 .workbook()
                 .worksheets("Sheet1")
                 .range(WorkbookWorksheetRangeParameterSet.newBuilder()
                         .withAddress("A1")
                         .build())
                 .buildRequest()
                 .get();
         LOGGER.info("Address should be 'Sheet1!A1', but is actually:\n{}\n", valueOfA1.address);
    

    But the same request as a plain HTTP request works, i.e. returns the desired range and has the correct address:

         GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/workbook/worksheets/Sheet1/range(address='A1')
    

    Hope you can help us with this.

  3. BaranwalG commented on Sep 20, 2022

    @BaranwalG
    Author

    Vincent Biret (@baywet) any update on this!

  4. JimeFuture commented on Sep 24, 2022

    @JimeFuture

    Is there any news on this topic? We are also missing the row and the column function for ranges.

  5. ramsessanchez commented on Oct 25, 2022

    @ramsessanchez
    Contributor

    Hi Gaurav Baranwal (@BaranwalG), JimeFuture, and @jkscx, what I had originally thought was an error in our Java-Core library turned out to be an issue with the way we generate our method RequestBuilders. This resulted in a low prioritization issue since we are currently working on our newest versions of our SDK. I am putting a PR together to address this issue across all classes which may be missing the lines noted by Gaurav Baranwal (@BaranwalG). In the meantime, I encourage you all to try out our Kiota-Built libraries, ie SDK version 6.0.0-snapshot, as they may be more reliable for these generation scenarios. I apologize for the delay and thank you all for your input. There may be about a week-long turn around before we see these generation changes implemented into our current v1 and beta libraries as our generation pipeline is run weekly on Tuesdays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions