Exemple #1
0
        public MAPIInfoStoreDescriptor(IEMsgStore msgStore)
        {
            _name           = msgStore.GetStringProp(MAPIConst.PR_DISPLAY_NAME);
            _entryId        = msgStore.GetBinProp(MAPIConst.PR_ENTRYID);
            _deletedItemsId = msgStore.GetBinProp(MAPIConst.PR_IPM_WASTEBASKET_ENTRYID);

            MAPIIDs mapiIds = msgStore.GetInboxIDs();

            if (mapiIds != null)
            {
                AddDefaultFolderEntryID(mapiIds.EntryID);
            }
            AddDefaultFolderEntryID(_deletedItemsId);
            AddDefaultFolderEntryID(msgStore.GetBinProp(MAPIConst.PR_IPM_SENTMAIL_ENTRYID));
            AddDefaultFolderEntryID(msgStore.GetBinProp(MAPIConst.PR_IPM_OUTBOX_ENTRYID));

            IEFolder rootFolder = msgStore.GetRootFolder();

            if (rootFolder != null)
            {
                using ( rootFolder )
                {
                    string parentEntryId = rootFolder.GetBinProp(MAPIConst.PR_PARENT_ENTRYID);
                    if (parentEntryId != null)
                    {
                        IEFolder parentFolder = msgStore.OpenFolder(parentEntryId);
                        if (parentFolder != null)
                        {
                            using ( parentFolder )
                            {
                                AddDefaultFolderEntryID(parentFolder.GetBinProp(MAPIConst.PR_IPM_APPOINTMENT_ENTRYID));
                                AddDefaultFolderEntryID(parentFolder.GetBinProp(MAPIConst.PR_IPM_CONTACT_ENTRYID));
                                AddDefaultFolderEntryID(parentFolder.GetBinProp(MAPIConst.PR_IPM_DRAFTS_ENTRYID));
                                AddDefaultFolderEntryID(parentFolder.GetBinProp(MAPIConst.PR_IPM_JOURNAL_ENTRYID));
                                AddDefaultFolderEntryID(parentFolder.GetBinProp(MAPIConst.PR_IPM_NOTE_ENTRYID));
                                AddDefaultFolderEntryID(parentFolder.GetBinProp(MAPIConst.PR_IPM_TASK_ENTRYID));
                                ArrayList additionalRenEntryIDs = parentFolder.GetBinArray(MAPIConst.PR_ADDITIONAL_REN_ENTRYIDS);
                                if (additionalRenEntryIDs != null && additionalRenEntryIDs.Count > 4)
                                {
                                    _junkEmailId = additionalRenEntryIDs[4] as string;
                                }
                                if (additionalRenEntryIDs != null)
                                {
                                    foreach (string id in additionalRenEntryIDs)
                                    {
                                        AddDefaultFolderEntryID(id);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            _supportMask = msgStore.GetLongProp(MAPIConst.PR_STORE_SUPPORT_MASK);

            _resource         = Core.ResourceStore.FindUniqueResource(STR.MAPIInfoStore, PROP.EntryID, _entryId);
            _storeTypeChecked = _resource == null?false:_resource.HasProp(PROP.StoreTypeChecked);
            if (_resource == null || !_storeTypeChecked)
            {
                try
                {
                    _supported        = OutlookSession.IsStorageSupported(msgStore);
                    _storeTypeChecked = true;
                }
                catch (COMException exception)
                {
                    Tracer._TraceException(exception);
                }
            }
            else
            {
                _supported = _resource.HasProp(PROP.StoreSupported);
            }
        }