コード例 #1
0
        public static List <WellKnownFolder> DiscoverWellKnownFolders(IMailbox mailbox, int flags)
        {
            Dictionary <WellKnownFolderType, byte[]> dictionary = new Dictionary <WellKnownFolderType, byte[]>();
            bool flag = ((FolderHierarchyFlags)flags).HasFlag(FolderHierarchyFlags.PublicFolderMailbox);

            FolderHierarchyUtils.FindWellKnownFolders(mailbox, flag ? FolderHierarchyUtils.PublicFolderMailboxRefs : FolderHierarchyUtils.MailboxRefs, (PropTag[] pta) => mailbox.GetProps(pta), dictionary);
            if (!flag)
            {
                FolderHierarchyUtils.FindWellKnownFoldersWithinInbox(mailbox, dictionary);
            }
            List <WellKnownFolder> list = new List <WellKnownFolder>();

            foreach (KeyValuePair <WellKnownFolderType, byte[]> keyValuePair in dictionary)
            {
                list.Add(new WellKnownFolder((int)keyValuePair.Key, keyValuePair.Value));
            }
            return(list);
        }