Пример #1
0
        /// <summary>
        /// Dump the MIME content of every message in the given folder.
        /// </summary>
        /// <param name="source">Source folder to get items from</param>
        /// <param name="traversal">The traversal level to pull items from</param>
        /// <param name="destinationFolderPath">Folder to save messages to</param>
        /// <param name="service">ExchangeService to use to make EWS calls</param>
        public static void DumpMIME(
            Folder source, 
            ItemTraversal traversal, 
            string destinationFolderPath, 
            ExchangeService service)
        {
            DebugLog.WriteVerbose("Dumping MIME contents of " + source.DisplayName);
            List<ItemId> itemIds = GetItemIds(source, service, traversal);

            DumpMIME(itemIds, destinationFolderPath, service);
        }
Пример #2
0
        /// <summary>
        /// Dump the properties from the given PropertySet of every message in the
        /// given folder to XML files.
        /// </summary>
        /// <param name="source">Source folder to get items from</param>
        /// <param name="traversal">The traversal level to pull items from</param>
        /// <param name="propertySet">PropertySet to use when getting items</param>
        /// <param name="destinationFolderPath">Folder to save messages to</param>
        /// <param name="service">ExchangeService to use to make EWS calls</param>
        public static void DumpXML(
            Folder source,
            ItemTraversal traversal,
            PropertySet propertySet,
            string destinationFolderPath,
            ExchangeService service)
        {
            List <ItemId> itemIds = GetItemIds(source, service, traversal);

            DumpXML(itemIds, propertySet, destinationFolderPath, service);
        }
Пример #3
0
        /// <summary>
        /// Dump the MIME content of every message in the given folder.
        /// </summary>
        /// <param name="source">Source folder to get items from</param>
        /// <param name="traversal">The traversal level to pull items from</param>
        /// <param name="destinationFolderPath">Folder to save messages to</param>
        /// <param name="service">ExchangeService to use to make EWS calls</param>
        public static void DumpMIME(
            Folder source,
            ItemTraversal traversal,
            string destinationFolderPath,
            ExchangeService service)
        {
            DebugLog.WriteVerbose("Dumping MIME contents of " + source.DisplayName);
            List <ItemId> itemIds = GetItemIds(source, service, traversal);

            DumpMIME(itemIds, destinationFolderPath, service);
        }
Пример #4
0
        public static void Show(
            string caption,
            Folder folder,
            ItemTraversal contentTraversal,
            ExchangeService service,
            Form parentForm)
        {
            FolderContentForm form = new FolderContentForm();

            form.ContentItemView.Traversal          = contentTraversal;
            form.CurrentService                     = service;
            form.currentFolder                      = folder;
            form.PropertyDetailsGrid.CurrentService = service;
            form.Text        = caption.Length == 0 ? "''" : caption;
            form.CallingForm = parentForm;
            form.Show();
        }
Пример #5
0
        private static List<ItemId> GetItemIds(Folder source, ExchangeService service, ItemTraversal traversal)
        {
            // Collect the Ids of all the items in the folder
            List<ItemId> itemIds = new List<ItemId>();

            FindItemsResults<Item> findResults = null;
            while (findResults == null || findResults.MoreAvailable == true)
            {
                DebugLog.WriteVerbose("Calling FindItems.");

                ItemView view = new ItemView(
                    GlobalSettings.DumpFolderViewSize,
                    itemIds.Count);

                view.Traversal = traversal;
                view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
                findResults = source.FindItems(view);

                DebugLog.WriteVerbose(String.Concat("FindItems returned {0} items", findResults.Items.Count));

                foreach (Item foundItem in findResults.Items)
                {
                    itemIds.Add(foundItem.Id);
                }
            }

            return itemIds;
        }
Пример #6
0
        /// <summary>
        /// Dump the properties from the given PropertySet of every message in the 
        /// given folder to XML files.
        /// </summary>
        /// <param name="source">Source folder to get items from</param>
        /// <param name="traversal">The traversal level to pull items from</param>
        /// <param name="propertySet">PropertySet to use when getting items</param>
        /// <param name="destinationFolderPath">Folder to save messages to</param>
        /// <param name="service">ExchangeService to use to make EWS calls</param>
        public static void DumpXML(
            Folder source,
            ItemTraversal traversal,
            PropertySet propertySet,
            string destinationFolderPath,
            ExchangeService service)
        {
            List<ItemId> itemIds = GetItemIds(source, service, traversal);

            DumpXML(itemIds, propertySet, destinationFolderPath, service);
        }
Пример #7
0
        private static List <ItemId> GetItemIds(Folder source, ExchangeService service, ItemTraversal traversal)
        {
            // Collect the Ids of all the items in the folder
            List <ItemId> itemIds = new List <ItemId>();

            FindItemsResults <Item> findResults = null;

            while (findResults == null || findResults.MoreAvailable == true)
            {
                DebugLog.WriteVerbose("Calling FindItems.");

                ItemView view = new ItemView(
                    GlobalSettings.DumpFolderViewSize,
                    itemIds.Count);

                view.Traversal   = traversal;
                view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
                source.Service.ClientRequestId = Guid.NewGuid().ToString();  // Set a new GUID
                findResults = source.FindItems(view);

                DebugLog.WriteVerbose(String.Concat("FindItems returned {0} items", findResults.Items.Count));

                foreach (Item foundItem in findResults.Items)
                {
                    itemIds.Add(foundItem.Id);
                }
            }

            return(itemIds);
        }