Beispiel #1
0
        /// <summary>
        /// CRUD operation for Outlook categories.
        /// </summary>
        /// <param name="exchangeService"></param>
        /// <returns></returns>
        public static async Task CreateReadUpdateOutlookCategory(ExchangeService exchangeService)
        {
            string          displayName = Guid.NewGuid().ToString();
            OutlookCategory category    = new OutlookCategory(exchangeService);

            category.Color       = CategoryColor.Preset18;
            category.DisplayName = displayName;

            await category.SaveAsync();

            FindItemResults <OutlookCategory> categories = await exchangeService.FindItems(
                new OutlookCategoryView(),
                null);

            bool found = false;

            foreach (OutlookCategory outlookCategory in categories)
            {
                if (outlookCategory.DisplayName == displayName)
                {
                    found = true;
                }
            }

            Assert.IsTrue(found);
            await category.DeleteAsync();
        }