Table of contents

SharePoint, a web-based collaboration and document management platform developed by Microsoft, allows its users to access and collaborate on documents, create intranet sites to share information, and more.
While you can benefit from SharePoint’s standalone features and capabilities in a variety of ways, you can get even more value by integrating it with your product or your internal applications.
To do so, you’ll first need to procure your unique API key. We’ll break down the steps for doing exactly that below!
To utilize SharePoint's API, it's essential to begin with a sandbox SharePoint account and an OAuth application. To acquire these, one should apply for a Microsoft Developer account via this link.
During the application process, you might be asked to specify your areas of interest. Should the options be presented, prioritize selections that encompass SharePoint, OneDrive, and Microsoft Graph.
Remember, your sandbox account will be refreshed every 90 days, provided it remains in active use.
Next, it's necessary to fill your SharePoint sandbox account with data.
https://www.merge.dev/blog/sharepoint-api-python?blog-related=image
Within your SharePoint account, create a site. (Either a Team or Communication site will work.)

Once your new site is created, navigate to Documents, and click + New to add new files and folders.

To create an OAuth app, navigate to your developer account, then navigate to Azure Active Directory > App Registrations > + New Registration to create a new OAuth app. If you’re using Postman to test the integration, add the Postman URL as your redirect URI.

You’ll see an app created with a provided client ID.

The last step is to create a client secret. To do so, click Client credentials > Client secrets > + New client secret.

Oauth:
authorize URL: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize
token URL: https://login.microsoftonline.com/organizations/oauth2/v2.0/token
scopes: “offline_access https://graph.microsoft.com/.default”
Copy and paste your client id from your OAuth app’s “Application (client) ID” and your client secret from your OAuth app’s “Client Secret > Value”.


In Postman, once you’ve entered all the params, click “Get Access Token”. This begins the OAuth flow, which ends with an “Authentication complete” screen. Use the access token provided by this flow, which Postman will automatically add as auth headers for your subsequent API requests!
Before integrating with the SharePoint API, it’s worth considering other items:
While SharePoint online starts at $5.00/user/month, if you sign up for a developer account you won’t be required to pay for the application.
SharePoint charges users for two different plans.
The developer and IT admin features in SharePoint, such as add-in hosting, app distribution, and Business Connectivity Services, are available with certain limitations based on the plan. For instance, features like InfoPath Forms Services and advanced search capabilities might require SharePoint Online Plan 2 or Office 365 Enterprise plans. These features are crucial for businesses looking for advanced customization, app integration, and automation capabilities.

Microsoft’s SharePoint API doesn’t actually have any defined, hard rate limits. Instead, the application will throttle when too many concurrent requests are made as it risks the quality of Microsoft’s servers. Requests made via REST calls can result in SharePoint Online returning a 429 “Too many requests” status code, or a 502 “Server too busy”, and cause the results to fail.
To effectively manage this, Microsoft recommends implementing exponential backoff in your application's retry logic. This means that the application should delay retrying a request that has been throttled and doubling the wait time with each retry, up to a maximum number of attempts. Additionally, it's important to avoid peak hours, perform operations off-hours, use batch requests judiciously, and design your app for efficiency with SharePoint's resources. Moreover, consider using the SharePoint Online Client Component SDK to handle retry logic automatically.
For a deeper dive on the best practices for avoiding throttling and for more detailed technical guidance, you can refer to the official Microsoft documentation: Avoid getting throttled or blocked in SharePoint Online.
SharePoint organizes content within site collections, sites, libraries, and lists, culminating in a hierarchical structure akin to drives, folders, and files. Due to this structure and the potentially vast amount of data stored within, instant retrieval of all items from large lists or libraries is impractical. To efficiently manage and access large datasets, SharePoint employs pagination.

Key Pagination Techniques in SharePoint:
Contextual Pagination Approaches:
Many of your customers use other file storage tools, like Box, Dropbox, or OneDrive.
You can offer integrations with any of the file storage applications your clients use by building to Merge’s File Storage Unified API.
To learn more about the API, and Merge’s platform more broadly, you can schedule a demo with one of our integration experts!
Learn how Merge can help you integrate your product with SharePoint—and many other file storage applications—through a single unified API.