none
[E2010] [EWSMA] [C#] [Windows]: Determine if meeting was sent by delegate RRS feed

  • Question

  • If I retrieve an appointment/meeting item using the EWSMA is there any way to tell if it was sent by a delegate? In Outlook the meeting request would show as being sent by "Delegate on behalf of Organizer", but the Organizer property of the Appointment item only contains the "Organizer" email address - is there a property somewhere that will show the "Delegate"?
    Tuesday, August 26, 2014 10:24 AM

Answers

  • You should be able to use the Extended properties to work this out have a read of http://msdn.microsoft.com/en-us/library/office/cc815707(v=office.15).aspx .

    eg this should cover your case "For example, suppose John is receiving Sally's messages while Sally is on vacation. The PR_RCVD_REPRESENTING properties identify John as the delegate recipient. When John sends a reply to a message that he has received for Sally, the message's PR_SENDER properties identify John as the sender. Because John is representing Sally, the PR_SENT_REPRESENTING properties identify Sally."

                ExtendedPropertyDefinition PR_SENDER_NAME = new ExtendedPropertyDefinition(0x0C1A,MapiPropertyType.String);
                ExtendedPropertyDefinition PR_SENT_REPRESENTING_NAME = new ExtendedPropertyDefinition(0x0042, MapiPropertyType.String);
                PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties) { PR_SENDER_NAME, PR_SENT_REPRESENTING_NAME };
                Message.Load(psPropSet);
                String PR_SENDER_NAMEval = "";
                String PR_SENT_REPRESENTING_NAMEval = "";
                if(Message.TryGetProperty(PR_SENDER_NAME,out PR_SENDER_NAMEval)){
                    Console.WriteLine(PR_SENDER_NAMEval);
                }
                if (Message.TryGetProperty(PR_SENT_REPRESENTING_NAME, out PR_SENT_REPRESENTING_NAMEval))
                {
                    Console.WriteLine(PR_SENT_REPRESENTING_NAMEval);
                }

    Cheers
    Glen

    • Marked as answer by Henry Buckle Sunday, September 21, 2014 7:32 AM
    Wednesday, August 27, 2014 4:27 AM

All replies

  • You should be able to use the Extended properties to work this out have a read of http://msdn.microsoft.com/en-us/library/office/cc815707(v=office.15).aspx .

    eg this should cover your case "For example, suppose John is receiving Sally's messages while Sally is on vacation. The PR_RCVD_REPRESENTING properties identify John as the delegate recipient. When John sends a reply to a message that he has received for Sally, the message's PR_SENDER properties identify John as the sender. Because John is representing Sally, the PR_SENT_REPRESENTING properties identify Sally."

                ExtendedPropertyDefinition PR_SENDER_NAME = new ExtendedPropertyDefinition(0x0C1A,MapiPropertyType.String);
                ExtendedPropertyDefinition PR_SENT_REPRESENTING_NAME = new ExtendedPropertyDefinition(0x0042, MapiPropertyType.String);
                PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties) { PR_SENDER_NAME, PR_SENT_REPRESENTING_NAME };
                Message.Load(psPropSet);
                String PR_SENDER_NAMEval = "";
                String PR_SENT_REPRESENTING_NAMEval = "";
                if(Message.TryGetProperty(PR_SENDER_NAME,out PR_SENDER_NAMEval)){
                    Console.WriteLine(PR_SENDER_NAMEval);
                }
                if (Message.TryGetProperty(PR_SENT_REPRESENTING_NAME, out PR_SENT_REPRESENTING_NAMEval))
                {
                    Console.WriteLine(PR_SENT_REPRESENTING_NAMEval);
                }

    Cheers
    Glen

    • Marked as answer by Henry Buckle Sunday, September 21, 2014 7:32 AM
    Wednesday, August 27, 2014 4:27 AM
  • Thanks, this works great.

    For anyone else working on this, I also loaded the PR_SENDER_EMAIL_ADDRESS and the PR_SENT_REPRESENTING_EMAIL_ADDRESS properties to get the email address of the delegate and the person they are representing. However these properties return the ExchangeDN rather than the SMTP address, so if you want to send a message to them you need to create a new EmailAddress with the routing type set to EX.

    ExtendedPropertyDefinition PR_SENDER_NAME = new ExtendedPropertyDefinition(0x0C1A, MapiPropertyType.String);
    ExtendedPropertyDefinition PR_SENDER_EMAIL_ADDRESS = new ExtendedPropertyDefinition(0x0C1F, MapiPropertyType.String);
    
    appointment.Load(
    new PropertySet(BasePropertySet.IdOnly,
    PR_SENDER_NAME,
    PR_SENDER_EMAIL_ADDRESS));
    
    string pr_sender_name = String.Empty;
    string pr_sender_email_address = String.Empty;
    
    appointment.TryGetProperty(PR_SENDER_NAME, out pr_sender_name);
    
    appointment.TryGetProperty(PR_SENDER_EMAIL_ADDRESS, out pr_sender_email_address);
    
    email = new EmailAddress(pr_sender_name, pr_sender_email_address, "EX");

    Sunday, September 21, 2014 7:32 AM