Exchange 2010 - Out Of Office Rule
Hello,
 
I was wondering, if there is any way to create out of office rules (Reply-With Templates, forwardings... http://office.microsoft.com/en-us/outlook-help/send-out-of-office-notices-automatically-with-an-exchange-account-HP001232830.aspx#BM2[^]) in Exchange 2010 using c#? (Preferably EWS)
 
I know that this can be done in Exchange 2003 using MAPI, but I was unable to find any Information for Exchange2010...
 
Any suggestions?
June 23rd, 2014 3:28pm

You can set the OOF setting of an account using the OOF operations in EWS see http://msdn.microsoft.com/en-us/library/office/hh532556(v=exchg.80).aspx

You can also create automatic reply rules using the Inbox Rule operations in EWS see http://msdn.microsoft.com/en-us/library/office/ff597938(v=exchg.80).aspx eg for an autoreply rule for a particular domain

           EmailMessage tmTemplateEmail = new EmailMessage(service);
           tmTemplateEmail.ItemClass = "IPM.Note.Rules.ReplyTemplate.Microsoft";
           tmTemplateEmail.IsAssociated = true;
           tmTemplateEmail.Subject = "Recipient of your Email action required";
           String htmlBodyString = "Hello,<p>Thanks for your Email we only answer emails enqiures from coperates email domains";
           tmTemplateEmail.Body =  new MessageBody(htmlBodyString);
           ExtendedPropertyDefinition  PidTagReplyTemplateId = new ExtendedPropertyDefinition(0x65C2, MapiPropertyType.Binary);
           tmTemplateEmail.SetExtendedProperty(PidTagReplyTemplateId, System.Guid.NewGuid().ToByteArray());
           tmTemplateEmail.Save(WellKnownFolderName.Inbox);
           Rule nrNewInboxRule = new Rule(); 
           nrNewInboxRule.DisplayName = "Auto Reply Rule";
           nrNewInboxRule.Conditions.ContainsSenderStrings.Add("@yahoo.com");
           nrNewInboxRule.Actions.ServerReplyWithMessage = tmTemplateEmail.Id;
           nrNewInboxRule.Exceptions.ContainsSubjectStrings.Add("RE:");
           nrNewInboxRule.Exceptions.ContainsSubjectStrings.Add("FW:");
           CreateRuleOperation createOperation = new CreateRuleOperation(nrNewInboxRule);
           service.UpdateInboxRules(new RuleOperation[] { createOperation }, true);

Cheers
Glen
Free Windows Admin Tool Kit Click here and download it now
June 24th, 2014 12:00am

Hello Glen,

thank you for replying, that's a great approach for creating inbox rules...

The problem with inbox rules is, that they are always active, regardless of the OOF state... The Automatic replies must only be sent while OOF is turned on... That's why I was looking for OOF rules like those you can create in outlook

Best regards,

Mark


June 24th, 2014 5:14am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics