Read the complete article on how to get contacts list from Microsoft Exchange Server in C#: https://blog.aspose.com/2022/03/28/get-contacts-list-from-ms-exchange-server-in-csharp/
Last active
March 28, 2022 14:30
-
-
Save aspose-com-gists/0879a1e9f06933f3d1105ef0dde6e026 to your computer and use it in GitHub Desktop.
Get Contacts List from Microsoft Exchange Server in C# .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create instance of IEWSClient class by giving credentials | |
IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain"); | |
string id = "<<Contact ID>>"; | |
// Get contact | |
Contact fetchedContact = client.GetContact(id); | |
// Use or manipulate contact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create instance of IEWSClient class by giving credentials | |
IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain"); | |
// List all the contacts | |
Contact[] contacts = client.GetContacts(client.MailboxInfo.ContactsUri); | |
foreach (MapiContact contact in contacts) | |
{ | |
// Display name and email address | |
Console.WriteLine("Name: " + contact.NameInfo.DisplayName + ", Email Address: " + contact.ElectronicAddresses.Email1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment