예제 #1
0
 public void PopulateTree()
 {
     foreach (IResource localAddressBook in Folder.GetFolders(_folderType))
     {
         AddLocalAddressBook(localAddressBook);
     }
     InsertTreeNodes(Nodes, _rootNode);
     ExpandAll();
 }
예제 #2
0
        private void ProcessContactFolders(int processedABs, int totalABs)
        {
            ArrayList toDeleteFolders = new ArrayList();

            foreach (IResource contactFolder in Folder.GetFolders(FolderType.Contact).ValidResources)
            {
                if (ShuttingDown)
                {
                    break;
                }
                OutlookSession.ProcessJobs();
                processedABs++;
                int percentage = (processedABs * 100) / totalABs;
                Settings.UpdateProgress(percentage, "Indexing Address Books", processedABs.ToString());

                PairIDs folderIDs = PairIDs.Get(contactFolder);
                if (folderIDs == null)
                {
                    toDeleteFolders.Add(contactFolder);
                    continue;
                }
                string abName = OutlookAddressBook.GetProposedName(contactFolder.GetPropText(Core.Props.Name), folderIDs.EntryId);
                Core.ResourceAP.QueueJob(new OutlookAddressBookReName(folderIDs.EntryId, abName));

                if (!Folder.IsIgnoreImport(contactFolder))
                {
                    ProcessContactFolder(folderIDs, abName);
                }
                else
                {
                    IResource AB = Core.ResourceStore.FindUniqueResource(STR.AddressBook, PROP.EntryID, folderIDs.EntryId);
                    if (AB != null)
                    {
                        new ResourceProxy(AB).DeleteAsync();
                    }
                }
            }
            foreach (IResource contactFolder in toDeleteFolders)   // delete corrupted 'MAPIFolder' resources
            {
                new ResourceProxy(contactFolder).DeleteAsync();
            }
        }
예제 #3
0
        private void SynchronizeContactsImpl()
        {
            _tracer.Trace("Start SynchronizeContactsImpl");

            Settings.UpdateProgress(0, "Computing Address Books count...", "");
            int totalABs     = Folder.GetFolders(FolderType.Contact).Count;
            int processedABs = 0;

            IEAddrBook addrBook = OutlookSession.GetAddrBook();

            if (addrBook != null)
            {
                int count = addrBook.GetCount();
                totalABs += count;
                for (int i = 0; i < count; ++i)
                {
                    if (ShuttingDown)
                    {
                        return;
                    }
                    OutlookSession.ProcessJobs();
                    ++processedABs;
                    int percentage = (processedABs * 100) / totalABs;
                    Settings.UpdateProgress(percentage, "Synchronizing Address Books", processedABs.ToString());
                    IEABContainer abContainer = addrBook.OpenAB(i);
                    if (abContainer == null)
                    {
                        continue;
                    }
                    using ( abContainer )
                    {
                        ProcessGlobalAddressBook(abContainer);
                    }
                }
            }
            ProcessContactFolders(processedABs, totalABs);
            _tracer.Trace("Finish SynchronizeContactsImpl");

            Settings.UpdateProgress(100, "Synchronizing Address Books", totalABs.ToString());
        }