internal override void Read(bool keepUnmanagedResources) { if (base.ObjectState != ObjectState.New) { throw new MapiInvalidOperationException(Strings.ExceptionObjectStateInvalid(base.ObjectState.ToString())); } Folder.CheckRequirementsToContinue(this.Identity, base.MapiSession); bool flag = false; ExTraceGlobals.FolderTracer.TraceDebug <FolderId, string>((long)this.GetHashCode(), "To Read Folder '{0}' from server '{1}'.", this.Identity, base.MapiSession.ServerName); base.EnableDisposeTracking(); using (MapiStore messageStore = this.GetMessageStore()) { using (MapiFolder mapiFolder = this.GetMapiFolder(messageStore)) { try { base.Instantiate(mapiFolder.GetProps(base.GetPropertyTagsToRead())); this.UpdateIdentity(this.UpdateIdentityFlagsForReading); flag = true; } finally { if (!keepUnmanagedResources || !flag) { base.Dispose(); } } } } base.ResetChangeTrackingAndObjectState(); }
private static MapiFolderPath GetFolderPath(MapiEntryId folderEntryId, MapiFolder mapiFolder, MapiStore mapiStore) { MapiFolderPath result; try { if (null == folderEntryId) { if (mapiFolder == null) { throw new ArgumentNullException("mapiFolder"); } PropValue prop = mapiFolder.GetProp(PropTag.EntryId); if (PropType.Error == prop.PropType) { return(null); } folderEntryId = new MapiEntryId(prop.GetBytes()); } if (mapiStore == null) { throw new ArgumentNullException("mapiStore"); } MapiEntryId operand; using (MapiFolder rootFolder = mapiStore.GetRootFolder()) { operand = new MapiEntryId(rootFolder.GetProp(PropTag.EntryId).GetBytes()); } MapiEntryId operand2 = new MapiEntryId(mapiStore.GetIpmSubtreeFolderEntryId()); MapiEntryId operand3 = new MapiEntryId(mapiStore.GetNonIpmSubtreeFolderEntryId()); MapiFolderPath mapiFolderPath = null; MapiEntryId mapiEntryId = folderEntryId; MapiEntryId mapiEntryId2 = null; string parentFolderName = null; while (!(operand2 == mapiEntryId)) { if (operand3 == mapiEntryId || operand == mapiEntryId) { mapiFolderPath = MapiFolderPath.GenerateFolderPath("NON_IPM_SUBTREE", mapiFolderPath, true); } else { using (MapiFolder mapiFolder2 = (MapiFolder)mapiStore.OpenEntry((byte[])mapiEntryId)) { PropValue[] props = mapiFolder2.GetProps(new PropTag[] { PropTag.ParentEntryId, PropTag.DisplayName }); if (PropType.Error == props[0].PropType || PropType.Error == props[1].PropType) { return(null); } mapiEntryId2 = new MapiEntryId(props[0].GetBytes()); parentFolderName = props[1].GetString(); } if (!(mapiEntryId2 == mapiEntryId)) { mapiFolderPath = MapiFolderPath.GenerateFolderPath(parentFolderName, mapiFolderPath, false); mapiEntryId = mapiEntryId2; continue; } } IL_19C: return(mapiFolderPath); } mapiFolderPath = MapiFolderPath.GenerateFolderPath("IPM_SUBTREE", mapiFolderPath, true); goto IL_19C; } catch (MapiPermanentException) { result = null; } catch (MapiRetryableException) { result = null; } return(result); }