Пример #1
0
        private static void ExecuteAction(IResource resFolder, string name)
        {
            Trace.WriteLine(">>> RenameFolderAction.ExecuteAction");
            PairIDs pairIDs = PairIDs.Get(resFolder);

            if (pairIDs == null)
            {
                return;
            }

            IEFolder folder = OutlookSession.OpenFolder(pairIDs.EntryId, pairIDs.StoreId);

            if (folder == null)
            {
                MsgBox.Error("Outlook plugin", "Cannot rename folder: it was not found in Outlook storage");
                return;
            }
            using ( folder )
            {
                folder.SetStringProp(MAPIConst.PR_DISPLAY_NAME, name);
                folder.SaveChanges();
            }

            Trace.WriteLine("<<< RenameFolderAction.ExecuteAction");
        }
Пример #2
0
        private void _ABList_ResourceChanged(object sender, ResourcePropIndexEventArgs e)
        {
            string    entryID   = e.Resource.GetStringProp(PROP.EntryID);
            IResource resFolder = Folder.Find(entryID);
            PairIDs   pairIDs   = PairIDs.Get(resFolder);

            if (pairIDs == null)
            {
                return;
            }

            IEFolder folder = OutlookSession.OpenFolder(pairIDs.EntryId, pairIDs.StoreId);

            if (folder != null)
            {
                using ( folder )
                {
                    if (!e.Resource.GetPropText(Core.Props.Name).EndsWith("(Outlook)"))
                    {
                        folder.SetStringProp(MAPIConst.PR_DISPLAY_NAME, e.Resource.GetStringProp(Core.Props.Name));
                        folder.SaveChanges();
                    }
                }
            }
        }
Пример #3
0
        public static void DeleteFolder(PairIDs folderIDs, bool DeletedItems, string newName)
        {
            if (!DeletedItems)
            {
                DeleteFolderImpl(folderIDs, false);
                return;
            }

            PairIDs deletedItems = OutlookSession.GetDeletedItemsFolderIDs(folderIDs.StoreId);

            if (deletedItems == null)
            {
                DeleteFolderImpl(folderIDs, false);
                return;
            }

            string   folderID = null;
            IEFolder folder   = OutlookSession.OpenFolder(folderIDs.EntryId, folderIDs.StoreId);

            if (folder != null)
            {
                using ( folder )
                {
                    folderID = folder.GetFolderID();
                }
            }
            if (folderID != null)
            {
                if (folderID != deletedItems.EntryId)
                {
                    if (newName != null)
                    {
                        IEFolder eFolder = OutlookSession.OpenFolder(folderIDs.EntryId, folderIDs.StoreId);
                        if (eFolder != null)
                        {
                            using ( eFolder )
                            {
                                eFolder.SetStringProp(MAPIConst.PR_DISPLAY_NAME, newName);
                                eFolder.SaveChanges();
                            }
                        }
                    }

                    if (MoveFolder(folderIDs.StoreId, folderIDs.EntryId, folderID, deletedItems))
                    {
                        return;
                    }
                }
            }
            DeleteFolderImpl(folderIDs, false);
        }