示例#1
0
文件: MAPIFolder.cs 项目: mo5h/omeo
        public static void LinkMail(IResource folder, IResource mail)
        {
            if (!Guard.IsResourceLive(folder))
            {
                return;
            }

            if (mail.Type != STR.Email && mail.Type != STR.Task)
            {
                throw new ArgumentException("Second parameter must be Email or Task, not " + mail.Type, "mail");
            }
            mail.SetProp(PROP.MAPIFolder, folder);
            IResource mapiStorage = GetMAPIStorage(folder);

            mail.SetProp(PROP.OwnerStore, mapiStorage);
            DateTime date = mail.GetDateProp(Core.Props.Date);

            if (folder.GetDateProp(PROP.LastMailDate) < date)
            {
                folder.SetProp(PROP.LastMailDate, date);
            }

            if (mail.Type == STR.Task)
            {
                return;
            }
            bool isDeletedItems = Folder.IsDeletedItems(folder) || mail.HasProp(PROP.DeletedInIMAP);

            Mail.SetIsDeleted(mail, isDeletedItems);
        }
示例#2
0
        private HashNode AddLocalAddressBook(IResource mapiFolder)
        {
            if (Folder.IsDeletedItems(mapiFolder))
            {
                Folder.SetIgnoreImportAsync(mapiFolder, _folderType, true);
                return(null);
            }
            IResource parentFolder = Folder.GetParent(mapiFolder);

            if (parentFolder == null)
            {
                ResourceProxy proxy = new ResourceProxy(mapiFolder);
                proxy.DeleteAsync();
                return(null);
            }
            if (Folder.IsRoot(parentFolder))
            {
                return(_rootNode.InsertResource(mapiFolder));
            }
            else
            {
                HashNode hasNode =
                    AddLocalAddressBook(parentFolder);
                if (hasNode == null)
                {
                    Folder.SetIgnoreImportAsync(mapiFolder, _folderType, true);
                    return(null);
                }
                return(hasNode.InsertResource(mapiFolder));
            }
        }
示例#3
0
文件: MAPIFolder.cs 项目: mo5h/omeo
        public static bool HasDeletedItemsAsAncestor(IResource folder)
        {
            IResource current = Folder.GetParent(folder);

            while (!Folder.IsRoot(current))
            {
                if (Folder.IsDeletedItems(current))
                {
                    return(true);
                }
                current = Folder.GetParent(current);
            }
            return(false);
        }
示例#4
0
 public void Execute(IActionContext context)
 {
     Tracer._Trace("Execute action: EmptyDeletedItemsFolderAction");
     if (context.SelectedResources.Count == 0)
     {
         return;
     }
     foreach (IResource resource in context.SelectedResources)
     {
         if (resource.Type == STR.MAPIFolder && Folder.IsDeletedItems(resource))
         {
             OutlookSession.OutlookProcessor.QueueJob(JobPriority.AboveNormal, "Empty folder action",
                                                      new ResourceDelegate(EmptyFolder), resource);
         }
     }
 }
示例#5
0
        public void Update(IActionContext context, ref ActionPresentation presentation)
        {
            if (context.SelectedResources.Count == 0)
            {
                presentation.Visible = false;
                return;
            }

            foreach (IResource resource in context.SelectedResources)
            {
                if (resource.Type != STR.MAPIFolder || !Folder.IsDeletedItems(resource))
                {
                    presentation.Visible = false;
                    return;
                }
            }
        }