private void InsertTreeNodes(TreeNodeCollection nodes, HashNode hashNode) { foreach (HashMap.Entry entry in hashNode.HashNodes) { IResource resource = ((HashNode)entry.Value).Resource; if (resource.Id == -1 || (resource.Type == STR.MAPIFolder)) { IResource store = Folder.GetMAPIStorage(resource); if (store.HasProp(PROP.IgnoredFolder)) { continue; } } int iconIndex = 0; IResource resourceTag = null; if (Folder.IsFolderOfType(resource, _folderType)) { iconIndex = _resourceIconManager.GetDefaultIconIndex(_resourceTypeForIcons); resourceTag = resource; } else { iconIndex = _resourceIconManager.GetDefaultIconIndex("MAPIFolder"); } TreeNode treeNode = new TreeNode(resource.DisplayName, iconIndex, iconIndex); treeNode.Tag = resourceTag; nodes.Add(treeNode); SetNodeCheckStateFromCollection(treeNode); InsertTreeNodes(treeNode.Nodes, (HashNode)entry.Value); } }
public MailDeletedDescriptor(MAPINtf ntf, string storeId) { Guard.NullArgument(ntf, "ntf"); Guard.NullArgument(storeId, "storeID"); IEMessage deletedItem = OutlookSession.OpenMessage(ntf.EntryID, storeId); if (deletedItem != null) { using ( deletedItem ) { Trace.WriteLine("Successfully opened deleted item resource"); string entryId = OutlookSession.GetMessageID(deletedItem); if (String.IsNullOrEmpty(entryId)) { throw new ArgumentNullException("entryId", "MailDeletedDescriptor -- NULL entryId string of the existing IEMessage"); } FindResourcesByEntryId(entryId); } } else { FindResourcesByEntryId(ntf.EntryID); if (_resourceToDelete != null) { return; } // we've got a short-term entry ID in the notification; we need to scan the parent // folder to find the resources which need to be deleted IEFolder parentFolder = OutlookSession.OpenFolder(ntf.ParentID, storeId); if (parentFolder != null) { using ( parentFolder ) { string parentId = OutlookSession.GetFolderID(parentFolder); IResource parentMAPIFolder = Folder.Find(parentId); if (parentMAPIFolder != null) { if (Folder.IsFolderOfType(parentMAPIFolder, FolderType.Contact)) { RemoveContactFromSync(parentId, storeId); return; } // Deletion from the folder which we ignore anyway // must not lead to a great performance loss. if (!parentMAPIFolder.HasProp(PROP.IgnoredFolder)) { FindResourceToDelete(parentFolder, parentMAPIFolder, storeId); } } } } } }
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); }