Unable to Retrieve Attachments from SharePoint List Using Python

Omkar Shende 0 Reputation points
2025-08-04T09:55:01.0166667+00:00

I'm using Python to fetch user details along with attachments (such as JPG/PNG files) from a SharePoint List. So far, I'm able to successfully retrieve the user details, but the attachments are not being returned.

I’ve configured API permissions in Azure (Microsoft Graph and SharePoint) and believe the necessary access has been granted.

What could be the possible reason I'm not getting the attachments? Is there an additional permission, endpoint, or method I should be using to retrieve them?

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

1 answer

Sort by: Most helpful
  1. Steven-N 5,575 Reputation points Microsoft External Staff Moderator
    2025-08-04T13:27:04.14+00:00

    Hi Omkar Shende

    Thanks for reaching out to Microsoft Q&A forum support

    Based on your description, I understand that you're successfully retrieving user details and attachments from a SharePoint List using Python and Microsoft Graph API for internal users, but attachments are not returned when the target user is a guest. 

    As far as I know, your issue is likely due to permission and access scope limitations specific to guest users in Microsoft 365. While internal users can access SharePoint list items and their attachments through Graph or REST APIs (provided the app has the correct permissions), guest users are subject to stricter access controls. Even if the app has been granted Sites.Read.All or Sites.FullControl.All permissions, guest users may not have sufficient rights to access attachments unless explicitly granted at the site or list level.

    To work around this, ensure that guest users are granted appropriate permissions directly on the SharePoint site or list containing the attachments. In some context, you may also need to use the SharePoint REST API to retrieve attachments, as Microsoft Graph does not currently support direct access to list item attachments. You can try to use The REST endpoint:   

    GET https://{site_url}/_api/web/lists/getbytitle('ListName')/items({item_id})/AttachmentFiles   
    

    This endpoint can be used to fetch attachment metadata and URLs. Confirm that guest users have access to these URLs and that the files are shared in a way that supports external access. This hybrid approach combining Graph API for metadata and REST API for attachments offers a more reliable solution when working with guest accounts. 

    Link reference: Working with folders and files with REST | Microsoft Learn 

    Hope my answer will help you, for further support, kindly let me know in the comment section


    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.


Your answer

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