Skip to content

Get 'Access to OData is disabled' error even though User-Agent is set in header #252

@fangzhoulu-hiretual

Description

@fangzhoulu-hiretual

Bug Report

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

Description

We are trying to create subscription on a exchange server whose EWS settings is EwsApplicationAccessPolicy : EnforceAllowList with EWSAllowList including our USER_AGENT,.However, we keeps getting Access to OData is disabled error.

The code is like:

const response = await client.api('/subscriptions').header('User-Agent', USER_AGENT).post({
  changeType: 'created',
  notificationUrl: process.env.OUTLOOK_WEBHOOK_URL,
  resource: '/me/messages',
  expirationDateTime: moment().add(SUBSCRIPTION_EXPIRE_TIME, 'minutes'),
  clientState: 'Something'
});

From the server log, the user agent inside header is still empty.
Refer: https://blogs.msdn.microsoft.com/wushuai/2017/04/01/how-to-fix-access-to-odata-is-disabled-when-calling-graph-api/

Error code:

{"statusCode":403,"code":"ExtensionError","message":"Operation: Create; Exception: [Status Code: Forbidden; Reason: Access to OData is disabled.]","requestId":"9af7d935-5ddc-4f2a-aa15-e7d35aa235b1","date":"2019-11-18T14:55:33.000Z","body":"{\"code\":\"ExtensionError\",\"message\":\"Operation: Create; Exception: [Status Code: Forbidden; Reason: Access to OData is disabled.]\",\"innerError\":{\"request-id\":\"9af7d935-5ddc-4f2a-aa15-e7d35aa235b1\",\"date\":\"2019-11-18T14:55:33\"}}"}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions