logo
search
Permission & Access Issues

Fix Access VBA WinHTTP SharePoint POST Access Denied Error

Maira MehtabMaira Mehtab Sep 20, 2026 868 views

Question details

Users experience an 'Access Denied' error (0x80070005) when sending SOAP POST requests to SharePoint via Access VBA WinHTTP after Internet Explorer was disabled.

Product
Microsoft Access
Device & OS
not provided
Scenario
Sending SOAP POST requests to SharePoint using Access VBA WinHTTP, previously relying on Internet Explorer for automatic authentication.
Observed behavior
The requests fail with error 2147024891 (0x80070005) 'Access Denied', and supplying WinHttpRequest credentials triggers an unexpected sign-in prompt despite an active Edge session.
Before you start

Ensure you have administrative privileges to register an application in Microsoft Entra ID (formerly Azure AD) to generate the required OAuth access tokens.

Solution 1Recommended

Implement OAuth 2.0 Authentication for SharePoint API

Replace the deprecated Internet Explorer browser session dependency by obtaining and passing an OAuth access token in your REST API requests.

Browsers and REST APIs do not automatically share authentication credentials. Since Internet Explorer is retired and modern browsers like Edge handle sessions differently, WinHttpRequest can no longer piggyback on the browser's active session.

To resolve the Access Denied error (0x80070005), your VBA application must explicitly authenticate using Microsoft Entra ID to obtain an OAuth access token, which is then passed in the request header.

1
Register the Application

Navigate to the Microsoft Entra admin center, go to App registrations, and register a new application to generate your Client ID and Tenant ID.

2
Configure API Permissions

Under the API permissions tab, grant the registered application the necessary SharePoint API permissions (e.g., Sites.ReadWrite.All) and click to grant admin consent.

3
Request an OAuth Access Token in VBA

Use a WinHTTP POST request to the Microsoft identity platform token endpoint (https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token), passing your Client ID, Client Secret, and scope to retrieve the JSON access token.

4
Attach Token to SharePoint Request

Modify your SharePoint SOAP/REST POST request headers to include the token by adding this code: WinHttpReq.SetRequestHeader "Authorization", "Bearer " & AccessToken.

Internet Explorer Retirement: Internet Explorer is no longer supported for SharePoint access. Relying on legacy browser session cookies for automated API requests is heavily discouraged by Microsoft.
Free Microsoft Office alternative

Experience a Seamless and Modern Office Suite with WPS Office

While specialized database API integrations require Microsoft Access, WPS Office provides a robust, lightweight, and completely free alternative for your daily document, spreadsheet, and presentation needs. Avoid legacy dependencies and enjoy modern compatibility.

  1. 1. Download the Installer: Visit the official WPS Office website and click the free download button for your operating system.
  2. 2. Install WPS Office: Run the downloaded setup file and follow the on-screen instructions to complete the installation.
  3. 3. Open Your Files: Launch WPS Office and easily open your existing Microsoft Office files without worrying about formatting issues.
Fully compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx).Lightweight software that loads quickly and consumes minimal system resources.Includes an intuitive tabbed interface for easier multitasking across different documents.Built-in PDF reader and editor to streamline your document workflows.
microsoft office alternative - wps office

Frequently Asked Questions

Why did my VBA WinHTTP request suddenly stop working?

Your application was likely relying on Internet Explorer's background session for automatic authentication. With Internet Explorer permanently disabled or removed, the API requests can no longer securely fetch these session credentials.

Can I use Microsoft Edge session cookies for VBA API calls?

No, Microsoft Edge isolates its session cookies differently than Internet Explorer. REST APIs and modern browsers do not automatically share credentials, meaning you must implement OAuth token-based authentication.

What is error 0x80070005 in SharePoint REST API?

Error 0x80070005 stands for 'Access Denied'. In the context of API requests, it typically means the request lacks valid authentication tokens or the provided credentials do not have the necessary permissions to perform the requested action.

How do I get an OAuth access token for SharePoint?

You must register your application in Microsoft Entra ID (Azure AD), grant it the appropriate SharePoint API permissions, and then programmatically send a request to the Microsoft Identity Platform endpoint using your Client ID and Client Secret to receive the token.