public void SetNodeCheckStateFromCollection(TreeNode node) { IResource resourceTag = (IResource)node.Tag; if (resourceTag != null) { HashMap.Entry checkEntry = _checkStates.GetEntry(resourceTag.Id); NodeCheckState check = NodeCheckState.Checked; if (checkEntry != null) { check = (NodeCheckState)checkEntry.Value; } else { if (!Folder.IsIgnoreImport(resourceTag)) { check = NodeCheckState.Checked; } else { check = NodeCheckState.Unchecked; } } SetNodeCheckState(node, check); } }
private static bool IsDataCorrect(FolderDescriptor folder) { IResource resource = Folder.Find(folder.FolderIDs.EntryId); if (resource == null || !Folder.IsFolderOfType(resource, FolderType.Contact) || Folder.IsIgnoreImport(resource)) { return(false); } return(true); }
private void ProcessGlobalAddressBook(IEABContainer abContainer) { IERowSet rowSet = abContainer.GetRowSet(); if (rowSet == null) { return; } using ( rowSet ) { string entryID = abContainer.GetBinProp(MAPIConst.PR_ENTRYID); IResource outlookAB = Core.ResourceStore.FindUniqueResource(STR.OutlookABDescriptor, PROP.EntryID, entryID); if (outlookAB == null) { return; } if (!Folder.IsIgnoreImport(outlookAB)) { string curName = abContainer.GetStringProp(MAPIConst.PR_DISPLAY_NAME); string abName = OutlookAddressBook.GetProposedName(curName, entryID); OutlookAddressBook AB = new OutlookAddressBook(abName, entryID, false); AB.RunAB(); int count = rowSet.GetRowCount(); for (int i = 0; i < count; i++) { if (ShuttingDown) { return; } OutlookSession.ProcessJobs(); string ABentryID = rowSet.GetBinProp(0, i /*MAPIConst.PR_ENTRYID*/); if (ABentryID == null) { continue; } Core.ResourceAP.QueueJob(new ContactDescriptor(rowSet, i, ABentryID, AB)); } } else { IResource AB = Core.ResourceStore.FindUniqueResource(STR.AddressBook, PROP.EntryID, entryID); if (AB != null) { new ResourceProxy(AB).DeleteAsync(); } } } }
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(); } }
protected override void Execute() { IResource task = GetTaskResource(); if (task == null) { Tracer._Trace("TASK IMPORT task not found"); } if (task != null) { if (_folder.ContainerClass != FolderType.Task) { Tracer._Trace("Delete task: id = " + task.Id); task.Delete(); return; } } IResource resFolder = Folder.Find(_folder.FolderIDs.EntryId); bool folderIgnored = (resFolder != null && Folder.IsIgnored(resFolder)) || OutlookSession.IsDeletedItemsFolder(_folder.FolderIDs.EntryId); if (folderIgnored) { if (task != null) { task.Delete(); } return; } bool import = resFolder != null && !Folder.IsIgnoreImport(resFolder); if (!import && task == null) { return; } if (task == null) { task = Core.ResourceStore.BeginNewResource(STR.Task); } else { task.BeginUpdate(); } string oldEntryID = task.GetStringProp(PROP.EntryID); if (oldEntryID == null) { task.SetProp(PROP.EntryID, _entryID); } else if (oldEntryID != _entryID) { throw new ApplicationException("Try to change entryID for task"); } if (resFolder != null) { Folder.LinkMail(resFolder, task); } if (!import) { task.EndUpdate(); if (Settings.TraceTaskChanges) { _tracer.Trace(task); } return; } task.SetProp(Core.Props.Subject, _subject); SetDateProp(task, Core.Props.Date, _dueDate); SetDateProp(task, PROP.StartDate, _startDate); if (_reminderActive == 0) { SetDateProp(task, PROP.RemindDate, DateTime.MinValue); } else { SetDateProp(task, PROP.RemindDate, _remindDate); } task.SetProp(PROP.Status, _status); task.SetProp(PROP.Priority, _priority); task.SetProp(PROP.Description, _description); task.AddLink(PROP.Target, Core.ResourceTreeManager.GetRootForType(STR.Task)); if (!task.HasProp(PROP.SuperTaskLink)) { task.SetProp(PROP.SuperTaskLink, Core.ResourceTreeManager.GetRootForType(STR.Task)); } if (Settings.SyncTaskCategory) { CategorySetter.DoJob(_outlookCategories, task); } bool wereChanges = task.IsChanged(); task.EndUpdate(); if (wereChanges && Core.TextIndexManager != null) { Guard.QueryIndexingWithCheckId(task); } if (Settings.TraceTaskChanges) { _tracer.Trace(task); } }