microsoftgraph / microsoftgraph/msgraph-sdk-python

A list item field with value 'PT' being converted to Datetime object

Abierto
#1,340 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Needs: Attention :wave: type:bug
Lenguaje dominante
Python
Estrellas
630
Forks
96
Merge medio
15 h 20 min
PR fusionados (30 d)
3

Descripción

Describe the bug

I am trying to iterate through a SharePoint list entries/rows for further processing:
...
list = await client.sites.by_site_id(site_id).lists.by_list_id(list_id).items.get(request_configuration=request_config)

rows = []
for item_id in list.value:
fields = item_id['fields']
rows.append(fields.additional_data.get("code")) # test
rows

but when text/string field have value 'PT' it is retrieved as a datetime (exactly: "datetime.timedelta(0)"). It makes my code useless for keeping for example 'Country Code' as list's field. I have seen similar issue before with 4-digit strings, so maybe it is related.

Please, take a moment to look at this.

here some screenshots:

list in SP (just field 'code' and its values) :

Image

and my code results:

Image
Expected behavior

Expected behavior would be to display 'code' the same way as it is in SharePoint list, means:
PT
PTA
..

How to reproduce

To reproduce please just create new list with text field. Then add value 'PT' to this field and try to use await client.sites.by_site_id(site_id).lists.by_list_id(list_id).items.get(request_configuration=request_config) for entried reading.

SDK Version

1.40.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con la ruta del Python SDK utilizada por await ...items.get(...) y sigue cómo se deserializa el valor del campo de la lista de SharePoint. Reproduce el caso con un campo de texto que contenga "PT" y añade una prueba de regresión específica; se considera terminado cuando el valor sigue siendo la cadena "PT" en lugar de convertirse en datetime.timedelta(0).

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
50/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.