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 8275263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:01:09+00:00 2026-06-08T08:01:09+00:00

Using the Exchange Web Services API, is it possible to determine whether a mailbox/e-mail

  • 0

Using the Exchange Web Services API, is it possible to determine whether a mailbox/e-mail address such as someone@mydomain.com exists within an organization?

If so, which is the simplest way to do this and is it possible without the use of impersonation?

Case: A Windows Service regularly sends e-mails to people within the organization. It does not have any explicit knowledge about their e-mail adresses. It only knows their username and assumes that their e-mail address is username@mydomain.com. This is true for all users except for a few that do not have mailboxes. In these cases, it should not attempt to send the e-mail in the first place.

Solution:

As suggested by mathieu: look for user and e-mail address in Active Directory instead. This function gets the job done:

using System.DirectoryServices.AccountManagement;
// ...

public static bool TryGetUserEmailAddress(string userName, out string email)
{
  using (PrincipalContext domainContext = 
    new PrincipalContext(ContextType.Domain, Environment.UserDomainName))
  using (UserPrincipal user = 
    UserPrincipal.FindByIdentity(domainContext, userName))
  {
    if (user != null && !string.IsNullOrWhiteSpace(user.EmailAddress))
    {
      email = user.EmailAddress;
      return true;
    }
  }
  email = null;
  return false; // user not found or no e-mail address specified
}
  • 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-08T08:01:11+00:00Added an answer on June 8, 2026 at 8:01 am

    Determining if an user has a mailbox with EWS only could be more complicated than expected, especially without impersonation.

    If you’re in an Active Directory domain, you should rely on the DirectoryEntry information to determine the mailbox of an user, and send email accordingly. If you got your user login, it’s really easy to get the associated DirectoryEntry.

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

Sidebar

Related Questions

Windows application invokes business logic Business logic creates new e-mail using Exchange Web Services
Is there a way, using Exchange Web Services Managed API, to query for a
I'm using the Exchange Web Services managed API and about once a day it
I have code to send email using Exchange Web Services (EWS 1.1 API). There
I'm using Exchange Web Services Managed API 1.0 to access the Exchange servers (2007)
I am using Exchange Web Services to try to get a list of all
I've written a C# program using managed Exchange Web Services (EWS) to query a
I have Exchange 2010 and I need to run a process using web services
I'm using Exchange web services, trying to create a calendar entry in another user's
I am writing a Java application to download emails using Exchange Web Services. I

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.