public static void Run() { const string mailboxUri = "https://exchnage/ews/exchange.asmx"; const string domain = @""; const string username = @"*****@*****.**"; const string password = @"password"; NetworkCredential credentials = new NetworkCredential(username, password, domain); IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials); Console.WriteLine("Connected to Exchange 2010"); // ExStart:ReadUserConfiguration // Get the User Configuration for Inbox folder UserConfigurationName userConfigName = new UserConfigurationName("inbox.config", client.MailboxInfo.InboxUri); UserConfiguration userConfig = client.GetUserConfiguration(userConfigName); Console.WriteLine("Configuration Id: " + userConfig.Id); Console.WriteLine("Configuration Name: " + userConfig.UserConfigurationName.Name); Console.WriteLine("Key value pairs:"); foreach (string key in userConfig.Dictionary.Keys) { Console.WriteLine(key + ": " + userConfig.Dictionary[key].ToString()); } // ExEnd:ReadUserConfiguration }
public static void Run() { // ExStart:ReadUserConfiguration IEWSClient client = GetExchangeEWSClient(); Console.WriteLine("Connected to Exchange 2010"); // Get the User Configuration for Inbox folder UserConfigurationName userConfigName = new UserConfigurationName("inbox.config", client.MailboxInfo.InboxUri); UserConfiguration userConfig = client.GetUserConfiguration(userConfigName); Console.WriteLine("Configuration Id: " + userConfig.Id); Console.WriteLine("Configuration Name: " + userConfig.UserConfigurationName.Name); Console.WriteLine("Key value pairs:"); foreach (string key in userConfig.Dictionary.Keys) { Console.WriteLine(key + ": " + userConfig.Dictionary[key].ToString()); } // ExEnd:ReadUserConfiguration }
public static void Run() { try { // ExStart:UpdatUserConfiguration IEWSClient client = GetExchangeEWSClient(); Console.WriteLine("Connected to Exchange 2010"); // Create the User Configuration for Inbox folder UserConfigurationName userConfigName = new UserConfigurationName("inbox.config", client.MailboxInfo.InboxUri); UserConfiguration userConfig = client.GetUserConfiguration(userConfigName); userConfig.Id = null; // Update User Configuration userConfig.Dictionary["key1"] = "new-value1"; client.UpdateUserConfiguration(userConfig); // ExEnd:UpdatUserConfiguration } catch (Exception ex) { Console.Write(ex.Message); } }