question

RahulDewangan-7472 avatar image
0 Votes"
RahulDewangan-7472 asked ·

I am trying to add message forwarding rule for a user but it is not working.

API : https://graph.microsoft.com/v1.0/users/rahul.dewangan@k4mobility.com/mailFolders/inbox/messageRules

request body : {
"displayName": "From partner",
"sequence": 2,
"isEnabled": true,
"conditions": {
"isAutomaticForward": true
},
"actions": {
"forwardTo": [
{
"emailAddress": {
"name": "Rahul Dewangan",
"address": "rahul.dewangan@truminds.com"
}
}
],
"stopProcessingRules": true
}
}

I am getting response as expected but rule is not added.42104-screenshot-from-2020-11-24-18-12-11.jpg

See in the screenshot Email forwarding NONE

office-exchange-server-administrationoffice-exchange-online-itpromicrosoft-graph-mail
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered ·

I tried the above payload, steps and it works for me!!

(1) Create a new rule using Graph API

 POST https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messageRules
 Content-type: application/json
    
 {      
     "displayName": "From partner",      
     "sequence": 2,      
     "isAutomaticForward": true,          
      "actions": {
         "forwardTo": [
           {
              "emailAddress": {
                 "name": "Alex Wilbur",
                 "address": "AlexW@contoso.onmicrosoft.com"
               }
            }
         ],
         "stopProcessingRules": true
      }    
 }

(2) Test whether the rule is working or not.

Result: It's working as expected

(3) Check that the above rule shows or not (as part of Outlook.office.com or Outlook UI's rule section)
Adding a snapshot that i captured from Outlook.office.com, mailbox settings!!

42281-image.png




image.png (56.4 KiB)
· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you try this same process to add a forwarding rule to a user? It is not working for me.

API : https://graph.microsoft.com/v1.0/users/{userId}/mailFolders/inbox/messageRules

0 Votes 0 ·