question

VineetKumar-6117 avatar image
0 Votes"
VineetKumar-6117 asked VineetKumar-6117 answered

Exchange EWS: This is returning X500 address instead of valid attendee (smtp) email address.

Dear team,

While fetching attendee data from Exchange using EWS, for some user (for some clients), we are receiving X500 address instead of valid email address.

So, Please answer below queries:


1. How to replicate the same on our environment (ie how to get X500 address for adding this for exchange Email)?
2. How to handle this X500 Address ( ie steps to convert this X500 address into valid email address)?
3. How to Validate X500 Address ( ie to find whether this is valid X500 address or not)?
4. Is there any other property in response which can return valid Email Address?

Below is detail explanation:

1 How we are getting the X500 address?

We are not trying to fetch X500 address.
We are fetching meeting information from Exchange using EWS and retrieving Attendee information from response. But in response, for some users, we found X500 address instead of attendee email address, which is not valid email address.

2 What EWS request is used to get the X500 address?

We are using BeginSyncFolderItems and EndSyncFolderItems.

3 Steps to call EWS programatically:

a) Create object of ExchangeService.
List down other propeties ie PropertySet | FolderId | ObjectState
Url : https://outlook.office365.com/EWS/Exchange.asmx
Credentials will be OAuthCredentials (ie new OAuthCredentials(token))
ExchangeService ExchangeServiceProcessor = new ExchangeService();
Then we call BeginSyncFolderItems.
ExchangeServiceProcessor.BeginSyncFolderItems(,,,,,,,,)

b) Then in response, we fetch the services ie
var ExchangeServiceProcessor = ((dynamic)ObjAsyncResult.AsyncState).Service;
Then we call EndSyncFolderItems ie
ChangeCollection<ItemChange> ChangedAppointment = ExchangeServiceProcessor.EndSyncFolderItems(ObjAsyncResult);
Then we fetch the Itemid.

c) Then we call serviceResponse collection based on itemId ie
exchangeServiceProcessor.BindToItems(ListOfIdsToLoad, PropertiesToLoad);

d) Then we fetch the appointment with response ie
Appointment ConvertedAppointment = (Appointment)BindResponse.Item;
This will further provides us attendee ie appointment.OptionalAttendees | appointment.RequiredAttendees.
Here we have Microsoft.Exchange.WebServices.Data.EmailAddress object which have Name & Address values.

office-exchange-server-administrationoffice-exchange-server-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @VineetKumar-6117 ,

The openspec-* tags are dedicated to supporting issues related to open specifications. You can find open specifications here https://docs.microsoft.com/en-us/openspecs/

Since your question does not pertain to one of these specifications, I've removed the openspecs-office-exchange tag and added the office-exchange-server-dev tag. Hopefully this will get your post the proper attention. The ews-managed-api tag on stackoverflow.com is also a good place to find an answers to your questions. This post might be relevant to your questions: https://stackoverflow.com/questions/11220363/ews-managed-api-syncfolderitems-how-to-update-and-delete-keeping-track-of-items

If I've misunderstood your question and you believe this is related to the Open Specifications documents, please clarify, providing the document name and section with which you have the question or issue.

Best Regards,

Michael Bowen
Escalation Engineer - Microsoft Open Specifications


1 Vote 1 ·
GlenScales-6756 avatar image
0 Votes"
GlenScales-6756 answered

Exchange always stores the Addresses for directory objects (eg things in the GAL) in the native EX Address (X500) address format. So the most common case you would see an EX address that doesn't get resolved which you use GetItem (or BindToItems) in you logic is where the directory object was deleted. Eg you have a recurring meeting that has attendees and one of those attendees leaves the company and the user account is deleted. If you want to reproduce this

Create a Test account
Create a meeting and invite that test account to that meeting so they are an attendee
Delete the Test account and wait for the directory replication to happen.

Try to retrieve the meeting you created, because the account nolonger exists it won't be able to resolve the EX Address to SMTP so you will just get the EX Address back.

The other cause I've see for this is when mailboxes are migrated using third party products that don't do the address translation correctly.

How to handle this X500 Address ( ie steps to convert this X500 address into valid email address)?

If the address exists in the GAL then resolvename should be able to resolve it to the SMTP address https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-resolve-ambiguous-names-by-using-ews-in-exchange-2013 (where this won't work if the directory object is hidden from the GAL).

How to Validate X500 Address ( ie to find whether this is valid X500 address or not)?

ResolveName should be able to do that or a Directory lookup of the proxyaddresses (eg use the Graph)





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

VineetKumar-6117 avatar image
0 Votes"
VineetKumar-6117 answered GlenScales-6756 commented

Thanks @GlenScales-6756 for reply.

We are not able to create X500 address format.
Using some logging, we found that this returns LegacyExchangeDN, and LegacyExchangeDN can be resloved with ResolveName.

Please have a look on below points and suggest:
1. How to create X500 address using Exchange Admin Center?
2. Can you please provide me something (may be powershell command) to create/fetch X500 address?
3.We have written the code to resolve the email address if X.500 string comes but we want to replicate it on our end.
For that we extracted LegacyExchangeDN using powershell command (Get-Mailbox -Identity user@domain.onmicrosoft.com | ft legacyExchangeDN). After that we added the LegacyExchangeDN value in user’s new email address like in the screen shot below. This user already as SMTP address added which we are not able to delete.
![196061-microsoftteams-image.png
But still, we are getting the user’s SMTP address when we try to fetch the Event’s attendee information.
How we can get new X.500 value that we added?
4.Three days ago, We delete the user from exchange but still we are able to fetch below json informations from Exchange ie
"{\r\n \"ResponseType\": 0,\r\n \"LastResponseTime\": null,\r\n \"Name\": \"deleteuser@o3651.domain.com\",\r\n \"Address\": \"deleteuser@o3651.domain.com\",\r\n \"RoutingType\": \"SMTP\",\r\n \"MailboxType\": 1,\r\n \"Id\": null\r\n}"
Am i missing something?
5. Any third party product to give info about X500 address?


Please suggest.








· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

With X500 address i would suggest you read https://blog.quadrotech-it.com/blog/what-is-the-x500-email-address/ like any address it can't be duplicated anywhere else. Make sure the account you deleted has been purged if the account is still recoverable it could still then be resolved. It sounds like you have some poorly migrated appointment objects meaning the recipientId's haven't been set correctly which can causing inconstant behaviours. If its only one or two meetings you see it on its sometime better to get them just to recreate the Meeting which will fix the issue.

0 Votes 0 ·
VineetKumar-6117 avatar image
0 Votes"
VineetKumar-6117 answered

Thanks @GlenScales-6756 .
We are not able to replicate this but using exchangeService.ResolveName, we are able to fix this.

If anything else come out, then i will be back to you again.

Again big thanks to you for your prompt reply.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.