1
votes

I tried googling it but didn't find any clear answer. Is it possible to pull Autolist contacts from exchange using EWS Api? I know i can search contacts by name, but can i pull them by autolist?

1
Do you need the autocomplete list from Outlook or from OWA?Jakob Christensen

1 Answers

2
votes

Using Exchange Service Managed API 2.0 this should do the trick:

private static void ListOwaAutocompleteCache(ExchangeService service, string email)
{
    var folderId = new FolderId(WellKnownFolderName.Root, email);
    var userConfig = UserConfiguration.Bind(service, "OWA.AutocompleteCache", folderId, UserConfigurationProperties.All);

    var xml = Encoding.UTF8.GetString(userConfig.XmlData);
    var xmlDoc = new XmlDocument();
    xmlDoc.LoadXml(xml.Substring(1));
    var nodes = xmlDoc.SelectNodes("AutoCompleteCache/entry");
    foreach (XmlNode node in nodes)
    {
        Console.WriteLine(node.Attributes["displayName"].Value + ", " + node.Attributes["smtpAddr"].Value);
    }
}