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

Issue with the SDK Request for Expanding Hidden Columns in SharePoint List #706

Open
M-Patrone opened this issue Oct 10, 2024 · 0 comments
Labels

Comments

@M-Patrone
Copy link

I'm not entirely sure if this is the right place to post this, but I figured I'd start here.

I've encountered an issue when trying to retrieve the columns of a list from a SharePoint site using the Microsoft Graph API. Specifically, I'm using the query parameter expand=hidden to include hidden columns in the response.

According to the documentation, the request should look like this: https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/columns?expand=hidden

This works perfectly in the Graph Explorer. However, when I click on the Code snippets option in Graph Explorer, it suggests the following C# code for the request:

var result = await graphClient.Sites["{site-id}"].Lists["{list-id}"].Columns.GetAsync((requestConfiguration) =>
{
	requestConfiguration.QueryParameters.Expand = new string []{ "hidden" };
});

When I try this code in my project, the request executes as follows: https://graph.microsoft.com/v1.0/sites/…/columns?%24expand=hidden. This results in an error:

{
    "error": {
        "code": "BadRequest",
        "message": "Parsing OData Select and Expand failed: Property 'hidden' on type 'microsoft.graph.columnDefinition' is not a navigation property or complex property. Only navigation properties can be expanded.",
        "innerError": {
            "date": "2024-10-10T19:19:00",
            "request-id": "a",
            "client-request-id": "7"
        }
    }
}

To solve this, I replaced the $ symbol with an empty string in the query parameter, and that seemed to work. However, this appears to be an issue with the SDK.

I believe this SDK is generated using Kiota, and I found an openapi.yaml file in this repository with the relevant configuration. My understanding is that the error might originate from this section:

 '/sites/{site-id}/lists/{list-id}/columns':
    description: Provides operations to manage the columns property of the microsoft.graph.list entity.
    get:
      tags:
        - sites.list
      summary: List columnDefinitions in a list
      description: Get the collection of columns represented as columnDefinition resources in a list.
      externalDocs:
        description: Find more info here
        url: https://learn.microsoft.com/graph/api/list-list-columns?view=graph-rest-1.0
      operationId: sites.lists.ListColumns
      parameters:
        - $ref: '#/components/parameters/top'
        - $ref: '#/components/parameters/skip'
        - $ref: '#/components/parameters/search'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/count'
        - name: $orderby
          in: query
          description: Order items by property values
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              type: string
        - name: $select
          in: query
          description: Select properties to be returned
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              type: string
        - name: $expand
          in: query
          description: Expand related entities
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              type: string

It seems that the parameter name $expand might need to be specified without the $ symbol here.

I would appreciate any guidance on whether the request should be updated to work with or without the $ symbol and how to make the necessary adjustments. I'm also willing to help but need some direction on where exactly to make changes.

Thank you for your time and assistance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant