How to Export SharePoint Permissions via API on Linux
Question details
The user needs to find the correct API method to export SharePoint site permissions after successfully granting consent and obtaining a bearer token in a Linux environment.

- Product
- SharePoint
- Device & OS
- Linux
- Scenario
- Developing an application or script on Linux to retrieve and export user permissions for a SharePoint site using API calls.
- Observed behavior
- The application is successfully configured and the bearer token is obtained, but the exact API endpoint and method to fetch the permission data are missing.
Ensure that your Azure AD application has been granted the appropriate administrative permissions, such as Sites.Read.All or Sites.FullControl.All, and that your Linux terminal has curl or a similar HTTP client installed.
Use Microsoft Q&A and SharePoint REST APIs
Leverage official developer documentation and community forums to identify the correct API endpoints for exporting SharePoint permissions.
Since you already have the bearer token, the next step involves calling the correct endpoints. You can use the SharePoint REST API or Microsoft Graph API to extract role assignments and site permissions.
Because specific endpoints may vary based on your SharePoint architecture (Online vs. On-Premises), consulting dedicated developer resources is the most reliable approach.
Use a tool like curl in your Linux terminal to send a GET request to the SharePoint REST endpoint (e.g., /_api/web/roleassignments). Include your bearer token in the Authorization header as 'Bearer [Your_Token]'.
If you encounter errors or need a specific script structure, navigate to the dedicated SharePoint Microsoft Q&A forum at https://learn.microsoft.com/en-us/answers/tags/235/office-sp to post your code and get developer assistance.
Search the Microsoft forums for related threads on calling SharePoint APIs using Azure AD applications to find exact syntax and JSON parsing methods suitable for Linux environments.

Analyze Your Exported Permission Data with WPS Office
After successfully exporting SharePoint permissions via API on Linux, you will likely receive the data in CSV or JSON format. WPS Office offers a natively supported Linux office suite that helps you organize, format, and analyze this data effortlessly without relying on expensive software.
- 1. Download the Linux Version: Visit the official WPS Office website and download the appropriate package (.deb or .rpm) for your Linux distribution.
- 2. Open Your Exported Data: Launch WPS Spreadsheets and open the CSV files generated by your SharePoint API script to quickly view and filter user permissions.

Frequently Asked Questions
Which API should I use to export SharePoint site permissions?
You can use the SharePoint REST API (specifically the /_api/web/roleassignments endpoint) or the Microsoft Graph API. Microsoft Graph is generally recommended for modern applications integrating with Azure AD.
How do I pass my bearer token in a Linux cURL command?
You can pass the token by adding the header flag: -H "Authorization: Bearer YOUR_TOKEN_HERE" to your cURL command targeting the SharePoint API URL.
Why is my API call returning an 'Access Denied' error even with a valid token?
This usually means the application lacks the correct scope or consented permissions in Azure AD. Ensure that permissions like 'Sites.Read.All' have been granted and admin consent has been applied.
Can I open the API JSON or CSV outputs on Linux natively?
Yes. Once you save the API response as a CSV file, you can open, format, and analyze it using spreadsheet software natively available on Linux, such as WPS Spreadsheets.




