Which one to use for getting smtp address of receipent of appointment item

Hi,

In order to extract primary smtp address from a receipient of appointment item, I have found two ways

1) _appItem.Recipients[i].Address

2) _appItem.Recipients[i].PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x39FE001E")

From the above two which one is preferable. From the first one for a specific user recently I'm facing the issue of getting smtp address as '

(/o=Ameriprise/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=smmulca488

'. Could you please suggest me how to proceed further on this.

Thank you in advance.

Thanks,

Gopi Santosh Boni

July 2nd, 2013 10:57am

Hi,

Please help me on the above question.

Thank you in advance.

Thanks,

Gopi Santosh Boni

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2013 6:11am

Hello,

Thank you for your post.

This is a quick note to let you know that we are performing research on this issue.

Cheers,
Tony Chen
Forum Support
________________________________________
Come back and mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback on our support, please contact tnmff@microsoft.com.

July 8th, 2013 10:06pm

Gopi,

In order to determine the SMTP address for a mail item/appointment item, you can use the SenderEmailAddress property of the MailItem object. However, if the sender is internal to your organization, SenderEmailAddress does not return an SMTP address, and you must use the PropertyAccessor object to return the senders SMTP address - this way you can overcome the issue. It works for me locally. So you can try the following code snippet (C#.Net) and see whether it helps you to move ahead or not.

private string GetSenderSMTPAddress(Outlook.MailItem mail)
{
    string PR_SMTP_ADDRESS =
        @"http://schemas.microsoft.com/mapi/proptag/0x39FE001E";
    if (mail == null)
    {
        throw new ArgumentNullException();
    }
    if (mail.SenderEmailType == "EX")
    {
        Outlook.AddressEntry sender =
            mail.Sender;
        if (sender != null)
        {
            //Now we have an AddressEntry representing the Sender
            if (sender.AddressEntryUserType ==
                Outlook.OlAddressEntryUserType.
                olExchangeUserAddressEntry
                || sender.AddressEntryUserType ==
                Outlook.OlAddressEntryUserType.
                olExchangeRemoteUserAddressEntry)
            {
                //Use the ExchangeUser object PrimarySMTPAddress
                Outlook.ExchangeUser exchUser =
                    sender.GetExchangeUser();
                if (exchUser != null)
                {
                    return exchUser.PrimarySmtpAddress;
                }
                else
                {
                    return null;
                }
            }
            else
            {
                return sender.PropertyAccessor.GetProperty(
                    PR_SMTP_ADDRESS) as string;
            }
        }
        else
        {
            return null;
        }
    }
    else
    {
        return mail.SenderEmailAddress;
    }
}

Let me know how it

Free Windows Admin Tool Kit Click here and download it now
July 9th, 2013 9:33pm

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

Other recent topics Other recent topics