Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:32:08+00:00 2026-06-04T16:32:08+00:00

I have an inbox set up in exchange, hello@mycompany.com Additionally, there is an alias

  • 0

I have an inbox set up in exchange, hello@mycompany.com

Additionally, there is an alias for this, news@mycompany.com, so all emails to the news address end up in the hello inbox.

Ideally, I want to be able to tell which alias an email has been sent to, using EWS.

When I send an email to news@mycompany.com, and examine the Internet headers of the message using Microsoft Outlook, the To: header reads To: Hello <news@mycompany.com> which is exactly what I want to see.

However, using EWS, when I look at the ToRecipients property of the message, the reported email address is always that of the primary SMTP address. Also the InternetMessageHeaders property of the Webservices.Data.Item does not contain the To: property. I also can’t seem to see the correct address using EWSEditor to examine all the properties of the message.

The answer to this forum post seems to suggest that,

…The Information about the actual email address a message is sent to is stored in the recipients collection which you can’t access (outside of exportmessage) in EWS…

How would I go about doing this programatically so I can find the correct To: address?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:32:09+00:00Added an answer on June 4, 2026 at 4:32 pm

    This works for me:

        private static string GetToAddress()
        {
            ExchangeService exService = new ExchangeService();
            exService.Credentials = new NetworkCredential("username", "password", "domain");
            exService.Url = new Uri("https://youraddress/EWS/Exchange.asmx");
    
            ExtendedPropertyDefinition PR_TRANSPORT_MESSAGE_HEADERS = new ExtendedPropertyDefinition(0x007D,MapiPropertyType.String);
            PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties)
                                        {PR_TRANSPORT_MESSAGE_HEADERS, ItemSchema.MimeContent};
    
            FindItemsResults<Item> fiResults = exService.FindItems(WellKnownFolderName.Inbox, new ItemView(1));
            foreach (Item itItem in fiResults.Items)
            {
                itItem.Load(psPropSet);
                Object valHeaders;
                if (itItem.TryGetProperty(PR_TRANSPORT_MESSAGE_HEADERS, out valHeaders))
                {
                    Regex regex = new Regex(@"To:.*<(.+)>");
                    Match match = regex.Match(valHeaders.ToString());
                    if (match.Groups.Count == 2)
                        return match.Groups[1].Value;
                }
                return ToAddress;
            }
            return "Cannot find ToAddress";
        }
    

    The code is from:
    http://social.technet.microsoft.com/Forums/en-au/exchangesvrdevelopment/thread/1e5bbde0-218e-466e-afcc-cb60bc2ba692

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this method to display the contact numbers in my inbox: public ArrayList<String>
I have a webservice that should return the top 5 emails in my inbox
i have an application with 3 tabs inbox,contacts and settings. In inbox, there is
I have about 17k emails containing orders, news, contacts etc. going back 11 years.
I have the following VBScript in a reusable action: 'Gather links Browser(1).Navigate http://InternalWebmail/something/inbox.nsf set
And this is pretty annoying since we have it set up to continuously check
I currently have this code. <?php $username = 'EMAIL ADDRESS'; $password = 'EMAIL ADDRESS';
I have created an inbox system. Signed in user can message other signed in
I have a program which reads Inbox messages from email accounts, as the title
i have developed a web servcies in my local system with name (inbox service).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.