コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GetUserConfigurationResponse"/> class.
        /// </summary>
        /// <param name="userConfiguration">The userConfiguration.</param>
        internal GetUserConfigurationResponse(UserConfiguration userConfiguration)
            : base()
        {
            EwsUtilities.Assert(
                userConfiguration != null,
                "GetUserConfigurationResponse.ctor",
                "userConfiguration is null");

            this.userConfiguration = userConfiguration;
        }
コード例 #2
0
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            // Write UserConfiguationName element
            UserConfiguration.WriteUserConfigurationNameToXml(
                writer,
                XmlNamespace.Messages,
                this.name,
                this.parentFolderId);

            // Write UserConfigurationProperties element
            writer.WriteElementValue(
                XmlNamespace.Messages,
                XmlElementNames.UserConfigurationProperties,
                this.properties.ToString().Replace(EnumDelimiter, string.Empty));
        }
コード例 #3
0
        /// <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="parentFolderId">The Id of the folder containing the user configuration.</param>
        /// <param name="properties">The properties to load.</param>
        /// <returns>A user configuration instance.</returns>
        public static UserConfiguration Bind(
            ExchangeService service,
            string name,
            FolderId parentFolderId,
            UserConfigurationProperties properties)
        {
            UserConfiguration result = service.GetUserConfiguration(
                name,
                parentFolderId,
                properties);

            result.isNew = false;

            return(result);
        }
コード例 #4
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);
            }
        }
コード例 #5
0
        /// <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="parentFolderId">The Id of the folder containing the user configuration.</param>
        /// <param name="properties">The properties to load.</param>
        /// <returns>A user configuration instance.</returns>
        public static async Task <UserConfiguration> Bind(
            ExchangeService service,
            string name,
            FolderId parentFolderId,
            UserConfigurationProperties properties,
            CancellationToken token = default(CancellationToken))
        {
            UserConfiguration result = await service.GetUserConfiguration(
                name,
                parentFolderId,
                properties,
                token);

            result.isNew = false;

            return(result);
        }
コード例 #6
0
ファイル: EwsCategory.cs プロジェクト: IvanFranjic/XEws
 public static void RebuildCategoryList(ExchangeService ewsSession, FolderId calendarFolderId, byte[] xmlData)
 {
     UserConfiguration userConfig = new UserConfiguration(ewsSession);
     userConfig.XmlData = xmlData;
     userConfig.Save("CategoryList", calendarFolderId);
 }