/// <summary>
 /// Binds to an existing user configuration and loads the specified properties.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="service">The service to which the user configuration is bound.</param>
 /// <param name="name">The name of the user configuration.</param>
 /// <param name="parentFolderName">The name of the folder containing the user configuration.</param>
 /// <param name="properties">The properties to load.</param>
 /// <returns>A user configuration instance.</returns>
 public static Task <UserConfiguration> Bind(
     ExchangeService service,
     string name,
     WellKnownFolderName parentFolderName,
     UserConfigurationProperties properties)
 {
     return(UserConfiguration.Bind(
                service,
                name,
                new FolderId(parentFolderName),
                properties));
 }
Esempio n. 2
0
        public static CategoryList Bind(ExchangeService service)
        {
            var item = UserConfiguration.Bind(service,
                                              "CategoryList",
                                              WellKnownFolderName.Calendar,
                                              UserConfigurationProperties.XmlData);

            using (var memory = new MemoryStream(item.XmlData))
            {
                var reader     = new StreamReader(memory, Encoding.UTF8, true);
                var serializer = new XmlSerializer(typeof(CategoryList));
                var result     = (CategoryList)serializer.Deserialize(reader);
                result._UserConfigurationItem = item;
                return(result);
            }
        }