microsoftgraph / microsoftgraph/msgraph-metadata
Issue with the SDK Request for Expanding Hidden Columns in SharePoint List
Nobody has claimed this yet.
- Dominant language
- XSLT
- Stars
- 166
- Forks
- 55
- Avg merge
- 16h 12m
- Merged PRs (30d)
- 14
Description
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!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the /sites/{site-id}/lists/{list-id}/columns GET definition in openapi.yaml and compare its $expand parameter with the C# request shown in the issue. Reproduce the generated request against the documented Graph endpoint, then determine whether the metadata or SDK generation needs adjustment; done means hidden columns can be retrieved successfully with the generated request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100