Esempio n. 1
0
 public override void OK()
 {
     //  Workaround of OM-13897, calling an OutlookSession in the shutdown
     //  state causes unpredictable results.
     if (Core.State == CoreState.Running)
     {
         _treeView.SaveCheckedState();
         MAPIIDs IDs = OutlookSession.GetInboxIDs();
         if (IDs != null)
         {
             IResource folder = Folder.Find(IDs.EntryID);
             if (folder != null && !Folder.IsIgnored(folder))
             {
                 Core.UIManager.CreateShortcutToResource(folder);
             }
         }
         SettingSaver.Save(Controls);
         Settings.LoadSettings();
     }
 }
Esempio n. 2
0
        public override void UndeleteResource(IResource res)
        {
            Guard.NullArgument(res, "res");
            IResourceList attachments = res.GetLinksOfType(null, PROP.Attachment);

            foreach (IResource attachment in attachments.ValidResources)
            {
                attachment.SetProp(Core.Props.IsDeleted, false);
            }

            IResource folder = null;
            MAPIIDs   IDs    = OutlookSession.GetInboxIDs();

            if (IDs != null)
            {
                folder = Folder.Find(IDs.EntryID);
            }

            if (folder != null)
            {
                MoveMessageToFolderAction action = new MoveMessageToFolderAction(false);
                action.DoMove(folder, res.ToResourceList());
            }
        }
Esempio n. 3
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);
            }
        }