Skip to content

List items for choice column type returns DateTime instead int #937

Closed

Description

Describe the bug

Hi,

I am trying to get items for my SPO list as:

expand = "fields"
filter_ = f"fields/Modified gt '{last_modified}'"
query_params = ItemsRequestBuilder.ItemsRequestBuilderGetQueryParameters(
                    expand=expand,
                    top=self.TOP_ITEMS,
                    filter=filter_,
            )
request_configuration = RequestConfiguration(query_parameters=query_params)
items = await client.sites.by_site_id(
                    self.site_id
                ).lists.by_list_id(
                    list_id
                ).items.get(request_configuration=request_configuration)

I have SPO choice column defined as:

image

Items returned are:

{'@odata.etag': '"0d9665c9-94e7-418b-bc92-3e5936c57d6d,30"',
 'Title': 'Test 2',
 'Choicecolumntest': DateTime(1000, 1, 1, 0, 0, 0, tzinfo=Timezone('UTC')),
}

It looks like there is a bug as it returns the DateTime instead int.

Expected behavior

When extracting the choice and multi-choice columns data types should be reflected correctly.

How to reproduce

Create list with choice column type and get items from list.

image

expand = "fields"
filter_ = f"fields/Modified gt '{last_modified}'"
query_params = ItemsRequestBuilder.ItemsRequestBuilderGetQueryParameters(
                    expand=expand,
                    top=self.TOP_ITEMS,
                    filter=filter_,
            )
request_configuration = RequestConfiguration(query_parameters=query_params)
items = await client.sites.by_site_id(
                    self.site_id
                ).lists.by_list_id(
                    list_id
                ).items.get(request_configuration=request_configuration)

SDK Version

1.4.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

20.04.6 LTS (Focal Fossa)

### Other information

_No response_

Activity

  1. shemogumbe commented on Oct 22, 2024

    @shemogumbe
    Contributor

    Hello Marta Kubinska (@mkkubins) thanks for using the SDK and for raising this.

    This is likely an issue with JSON serialization.

    What is your version the json srialization library are you using, is it the latest.

    This could be related to microsoft/kiota-serialization-json-python#358

    Please confirm if you have this even with latest version of the serialization library?

  2. mkkubins commented on Oct 23, 2024

    @mkkubins
    Author

    After upgrading to the latest version issue is fixed. Thanks for help!

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

Metadata

Metadata

Labels

status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions