Keshi
Keshi

Reputation: 1086

Approve email message via exchange EWS API

I have a situation where I would need to re-route messages to a different mailbox who would be the moderator. Programmatically - is there a way to approve the message I get in the moderator's mailbox? I dont see explicit support in EWS for it. Does any other API type that microsoft has support this?

Upvotes: 5

Views: 1763

Answers (2)

Shubham
Shubham

Reputation: 108

This is not an official approved way but the following workaround worked for me to approve and reject messages in the moderator's mailbox!

Below is a Powershell code that does the job!

Things to Note:

Item Classes: $EmailMessage.ItemClass = "IPM.Note.Microsoft.Approval.Reply.Approve" $EmailMessage.ItemClass = "IPM.Note.Microsoft.Approval.Reply.Reject"

Subject - Use the Normalized subject from the approval Request email and then append Accept or Reject.

RecipientTo - Needs to be set to the Microsoft Exchange Approval Assistant Address.

For Example, to Reject a mail from the Moderator's Mailbox:

$PR_REPORT_TAG = new-object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x0031,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Binary);
$VerbResponse = new-object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition([Microsoft.Exchange.WebServices.Data.DefaultExtendedPropertySet]::Common,0x8524,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);  

$ReportID = $null
[Void]$Item.TryGetProperty($PR_REPORT_TAG,[ref]$ReportID)
$EmailMessage.SetExtendedProperty($VerbResponse,"Reject")
$EmailMessage.SetExtendedProperty($PR_REPORT_TAG,$ReportID)

Do take a look at this link! It's nicely explained!

Upvotes: 3

Marc LaFleur
Marc LaFleur

Reputation: 33094

This isn't possible via the Graph or Outlook REST APIs.

You might be able to accomplish this using Transport Rules. There is a scenario documented for setting up an Email Approval Chain that sounds similar. This is a configuration procedure however, not a REST API.

Upvotes: 2

Related Questions