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)); } }
public static bool IsAncestor(IResource folder, IResource possibleAncestor) { IResource current = Folder.GetParent(folder); while (!Folder.IsRoot(current)) { if (current == possibleAncestor) { return(true); } current = Folder.GetParent(current); } return(false); }
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); }