Share via

Sharepoint List items returning empty

Sankaralingam.DhilipanSomasundaram 40 Reputation points
2023-12-19T04:26:35.4066667+00:00

After getting permissions for Sharepoint Online Site, It is returning empty set(though we could see data) when trying to perform get() operation.

Here is the code snippet:
ctx = ClientContext(test_site_url).with_client_credentials(test_client_id, test_client_secret)

tasks_list = ctx.web.lists.get_by_title("X X X X")

items = tasks_list.items.get().execute_query()

result of items: []

Note: Previously, it gave "'Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))'"; It was resolved after getting permission

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

Answer accepted by question author
  1. Ling Zhou_MSFT 23,690 Reputation points Microsoft External Staff
    2023-12-19T07:00:23.9933333+00:00

    Hi @Sankaralingam.DhilipanSomasundaram,

    Thank you for posting in this community.

    Please try to use this code to get items of a list:

    items = tasks_list.get_items()
    ctx.load(items)
    ctx.execute_query()
    
    print(items)
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.