Disable mail forward throug MS Graph

Hari S 36 Reputation points
2022-12-14T07:57:08.637+00:00

Hi,

I want to disable "email forward" programmatically. Could you please help whether it can be possible through MS graph?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,704 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Mehtab Siddique (MINDTREE LIMITED) 971 Reputation points
    2022-12-14T20:08:11.917+00:00

    There is way to unsubscribe way to opt out:

    Submits a email request on behalf of the signed-in user to unsubscribe from an email distribution list. Uses the information in the List-Unsubscribe header.

    Message senders can use mailing lists in a user-friendly way by including an option for recipients to opt out. They can do so by specifying the List-Unsubscribe header in each message following RFC-2369.

    Note In particular, for the unsubscribe action to work, the sender must specify mailto: and not URL-based unsubscribe information.

    POST /users/{id | userPrincipalName}/messages/{id}/unsubscribe  
    

    This feature is only available in the beta version.

    For more infromation: https://learn.microsoft.com/en-us/graph/api/message-unsubscribe?view=graph-rest-beta&tabs=http&viewFallbackFrom=graph-rest-1.0

    0 comments No comments

  2. Glen Scales 4,446 Reputation points
    2022-12-15T01:20:29.67+00:00

    It depends how forwarding has been configured if its a Mailbox Rule there you should be able to just delete the rule https://learn.microsoft.com/en-us/graph/api/messagerule-delete?view=graph-rest-1.0&tabs=http it can also be configured as part of the Out of Office setting or potentially even calendar delegates.

    If its been configured using Set-Mailbox eg https://learn.microsoft.com/en-us/exchange/recipients/user-mailboxes/email-forwarding? then you can't use the Graph to unset it you need to use Exchange cmdlets eg ExoV3. You can do it in an app using https://learn.microsoft.com/en-us/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.