Skip to content

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

Description

@mkkubins

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_

Metadata

Metadata

Assignees

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