Reading custom properties from Routing Agent RRS feed

  • Question

  • Hello,

    I have a task to reroute a message for users if they are from different organization than sender. OrganizationIdentifier is saved in CustomAttribute14. 

    Is it possible to read this information for sender and for all recepients in the To list from RoutingAgent environment?

    Thank you in advance.  

    Thursday, January 12, 2012 6:39 AM

All replies

  • Not directly you would need to bind to each AD user object which in a large organization and high volume Hub server is something you probably don't want to do because of the potential performance implications. Eg how you can do is is you can use the GUID and DN of the Sender

            foreach (EnvelopeRecipient ev in qmQueuedMessage.MailItem.Recipients) {
                if (ev.Properties.ContainsKey("Microsoft.Exchange.Transport.DirectoryData.ObjectGuid"))
                    DirectoryEntry deDirEntry = new DirectoryEntry(("LDAP://<GUID=" + ev.Properties["Microsoft.Exchange.Transport.DirectoryData.ObjectGuid"] + ">"));
                    String cpPropVal = deDirEntry.Properties["extensionAttribute15"].Value.ToString();
            if (qmQueuedMessage.MailItem.Properties.ContainsKey("Microsoft.Exchange.Transport.DirectoryData.Sender.DistinguishedName"))
                String SendValdn = qmQueuedMessage.MailItem.Properties["Microsoft.Exchange.Transport.DirectoryData.Sender.DistinguishedName"].ToString();
                DirectoryEntry deDirEntry = new DirectoryEntry(("LDAP://" + SendValdn));
                String spPropVal = deDirEntry.Properties["extensionAttribute15"].Value.ToString();

    I would try to use one of the other Identifiers that are available in the properties collection rather then trying to bind to each AD object eg you can get the LegacyExchangeDN etc.


    Friday, January 13, 2012 5:23 AM