How to Get SharePoint Site Members with Office365 REST Python Client
Question details
The user needs to retrieve an accurate, up-to-date list of SharePoint site members using the Office365 REST Python Client API.

- Product
- SharePoint / Office365 REST Python Client
- Device & OS
- not provided
- Scenario
- Retrieving current SharePoint site membership using Python API queries.
- Observed behavior
- The Python client successfully connects but returns users who are no longer members, failing to match the current list on the SharePoint People page.
Verify that you are using the latest version of the Office365-REST-Python-Client library and ensure your account has the necessary site admin permissions to view full membership directories.
Consult the Microsoft Q&A SharePoint Development Forum
Since this involves specific behavior of the Office365-REST-Python-Client and SharePoint REST API, reaching out to Microsoft's specialized developers is the recommended approach.
The discrepancy in membership results often stems from how the SharePoint API handles cached user profiles in the hidden SiteUserInfoList versus active site members. The Microsoft Q&A forum hosts dedicated engineers who can investigate specific API queries, library behaviors, and tenant configurations.
Go to the official Microsoft Q&A website and browse to the SharePoint development category.
Search for your specific issue regarding the Office365 REST Python Client returning outdated members, as related discussions and solutions are often already posted.
Create a new thread detailing your Python code snippet, the specific REST endpoint you are calling (e.g., _api/web/siteusers), and the discrepancy you observe compared to the SharePoint People page.

Experience a Lightweight Office Alternative with WPS Office
While specialized SharePoint development requires Microsoft's ecosystem, for your daily document, spreadsheet, and presentation needs, WPS Office offers a powerful, free, and highly compatible alternative.
- 1. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install WPS Office: Run the setup file and follow the simple on-screen instructions to complete the installation in seconds.
- 3. Open Office Files: Instantly open, edit, and save your existing .docx, .xlsx, and .pptx files without any formatting loss.

Frequently Asked Questions
Why does the SharePoint API return deleted or inactive users?
The SharePoint REST API often queries the SiteUserInfoList (a hidden user list), which retains user profiles even after they are removed from active site groups to preserve historical metadata for documents they created or modified.
How can I filter out inactive users in my Python API query?
You may need to query specific SharePoint groups directly (e.g., `_api/web/sitegroups/getbyname('GroupName')/users`) rather than querying the entire site users list. This approach generally provides an accurate reflection of current active members.
Where is the best place to report bugs for the Office365-REST-Python-Client?
Since it is an open-source library, you can report bugs or issues directly on its GitHub repository's Issues page. For broader API behavior questions, the Microsoft Q&A SharePoint development forums are the best resource.




