Systematic error trying to get SharePoint list items - Microsoft Graph

Tourmente T 40 Reputation points
2024-03-06T14:06:49.7+00:00

Hi,

I'm getting a systematic error trying to use Microsoft Graph to get SharePoint list items.

Here is my function (identical to the documentation: https://learn.microsoft.com/en-us/graph/api/listitem-list?view=graph-rest-1.0&tabs=http):

query_params = ItemsRequestBuilder.ItemsRequestBuilderGetQueryParameters(
                expand = ["fields"],
        )
    request_configuration = ItemsRequestBuilder.ItemsRequestBuilderGetRequestConfiguration(
    query_parameters = query_params,
        )
    result = await graph_client.sites.by_site_id(site_id).lists.by_list_id(list_id).items.get(request_configuration = request_configuration)

Here is the full error :

Traceback (most recent call last):     
File "j:\Python\Script.py", line 1152, in function     
result = loop.run_until_complete(get_items())                                               				  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   
File "J:\Python\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "j:\Python\Script.py", line 353, in function2     result = await graph_client.sites.by_site_id(site_id).lists.by_list_id(list_id).items.get(request_configuration = request_configuration)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\msgraph\generated\sites\item\lists\item\items\items_request_builder.py", line 65, in get
    return await self.request_adapter.send_async(request_info, ListItemCollectionResponse, error_mapping)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\kiota_http\httpx_request_adapter.py", line 192, in send_async
    value = root_node.get_object_value(parsable_factory)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 212, in get_object_value
    self._assign_field_values(result)
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 281, in _assign_field_values
    field_deserializer(JsonParseNode(field_value))
  File "J:\Python\Lib\site-packages\msgraph\generated\models\list_item_collection_response.py", line 40, in <lambda>
    "value": lambda n : setattr(self, 'value', n.get_collection_of_object_values(ListItem)),
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 163, in get_collection_of_object_values
    return list(
           ^^^^^
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 165, in <lambda>
    lambda x: self._create_new_node(x).get_object_value(factory),  # type: ignore
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 212, in get_object_value
    self._assign_field_values(result)
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 281, in _assign_field_values
    field_deserializer(JsonParseNode(field_value))
  File "J:\Python\Lib\site-packages\msgraph\generated\models\list_item.py", line 76, in <lambda>
    "fields": lambda n : setattr(self, 'fields', n.get_object_value(FieldValueSet)),
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 212, in get_object_value
    self._assign_field_values(result)
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 283, in _assign_field_values
    item_additional_data[field_name] = self.try_get_anything(field_value)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 294, in try_get_anything
    return list(map(self.try_get_anything, value))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\kiota_serialization_json\json_parse_node.py", line 299, in try_get_anything
    datetime_obj = pendulum.parse(value)
                   ^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\pendulum\parser.py", line 30, in parse
    return _parse(text, **options)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\pendulum\parser.py", line 43, in _parse
    parsed = base_parse(text, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\pendulum\parsing\__init__.py", line 78, in parse
    return _normalize(_parse(text, **_options), **_options)
                      ^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\pendulum\parsing\__init__.py", line 116, in _parse
    return _parse_iso8601_interval(text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "J:\Python\Lib\site-packages\pendulum\parsing\__init__.py", line 221, in _parse_iso8601_interval
    elif last[0] == "P":
         ~~~~^^^
IndexError: string index out of range


Thanks for your help

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,445 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,516 questions
{count} votes