none
How can I approve/reject emails programmably? RRS feed

  • Question

  • I am developing a C# to manage the exchange server of my organization. The transport rules are also setup. Now I run into a problem when I want to approve/reject messages programmably.

    For example, the rule is when any emails was send to Group A of my organization, it will be forward to a Moderator Account for approval. I glanced almost all the function in the API and found no one.

    My question is: how can I do this programmably, say using c#?

    BTW: the version of my exchange server is 2010.

    Thank you

    Friday, July 29, 2011 7:36 PM

All replies

  • Hi,

    I think this is a configuration of the distributionlist.

    have a look at topic 11 of the article:

    http://technet.microsoft.com/en-us/library/bb125178.aspx

     

     


    regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com
    Friday, July 29, 2011 9:40 PM
  • There are no operations in EWS to do the actual release what you would need to do is manually construct the release message by setting the appropriate mapi properties on a message and then send it. I don't think this is actually documented anywhere (it should be part of the Exchange protocol documents http://msdn.microsoft.com/en-us/library/cc425499%28v=exchg.80%29.aspx)  so you would probably need to reverse engineer the process using a Mapi editor like MFC Mapi to see what properties are set on a message when the process is manually invoked in Outlook.

    Cheers
    Glen

    Tuesday, August 2, 2011 3:44 AM
  • It seems you are right, Glen, that there is no operations available in EWS to do the job I described. I found that ItemClass property describes the type of the message, say IPM.Microsoft.Approval.Request means this message needs approval, and IPM.Microsoft.Approval.Rejected means it was rejected.

    Ideally, by setting this property and then sending the message will do the work. But there comes another problem:

    Suppose my organization is AAA.com, an external user namely xxx@external.com sends email to user@AAA.com, the moderator accounts admin@AAA.com will approve/reject the email. How can admin@AAA.com send the email without having the credential of xxx@external?

    xxx@external.com ---> admin@AAA.com -----> user@AAA.com

    Any insightful discussion will be appreciated.

    Many thanks.

    YX

     

     

    Tuesday, August 2, 2011 1:54 PM
  • >Suppose my organization is AAA.com, an external user namely xxx@external.com sends email to user@AAA.com, the moderator accounts admin@AAA.com will approve/reject the email. How can admin@AAA.com send the email without having the credential of xxx@external?

    Not sure I'm following you correctly here the approval email will always come from the moderator which would be your admin@AAA.com the server will then release the message from the arbitration mailbox based on the approval request. The only instance where you would need to send as xxx@external would be where you where trying to connect to arbitration mailbox directly and resending the message from there where your more or less bypassing the moderation framework but the best method would be to keep within that framework.

    Cheers
    Glen


    Wednesday, August 3, 2011 12:34 AM
  • Yes, the moderator account will receive an email for approval. Theoretically, I am with you on releasing the message from the arbitration mailbox. The problem is how I can access the arbitration mailbox programmably? I tried connecting using powershell and "Get-Mailbox -Arbitration" and got an error, saying that "-Arbitration" couldn't be found.

    Can you shed some light on this?

    BTW: I am now programming locally on my own Exchange Server, but later on it will be migrated to Live@Edu exchange server.

    Thank you, Glen.

    YX

    Wednesday, August 3, 2011 6:06 PM
  • There are a few things that might cause that result the first would be that the account your using hasn't been granted the correct RBAC roll to view/set arbitration mailboxes. The other is they maybe have not been setup or disabled have a look at http://social.technet.microsoft.com/Forums/en-US/exchangesvrgeneral/thread/5b697bba-f8ba-4226-9b99-f9b6f60a45ce/.

    Cheers
    Glen

    Thursday, August 4, 2011 10:32 AM
  • Thank you Glen.

    I tried with my Live@Edu account and it doesn't provide the -Arbitration option. Should the arbitration mailbox be default in Live@Edu? Otherwise where is the emails that need moderation saved? In my C# program, I can easily link to Inbox/Outbox/... using the following code:

     

        //////////// Live@Edu
                ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
                service.Credentials = new WebCredentials("myliveeduaccount@xxx.com", "password");
                service.Url = new Uri(@"https://livedduserver");
    //////////// Bind to Inbox folder.
                Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
    How can I adjust this to link to the arbitration mailbox then.
    YX

     

    Friday, August 5, 2011 1:34 PM
  • This is tricky question you may need to ask Live@edu /Office365 support directly it maybe this feature can't be self provisioned or is not available because of the shared nature of the service (most probably it just something that will need to be provisioned for you).

    Cheers
    Glen  

    Friday, August 5, 2011 11:45 PM