none
Exchange 2010 - Out Of Office Rule RRS feed

All replies

  • 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
    Tuesday, June 24, 2014 3:49 AM
  • 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


    Tuesday, June 24, 2014 9:03 AM