public PublicFolderSession GetPublicFolderSession(StoreId folderId) { PublicFolderSession result; using (this.CheckDisposed("GetPublicFolderSession")) { ExTraceGlobals.SessionTracer.TraceDebug <StoreId>((long)this.GetHashCode(), "PublicFolderSessionCache.GetPublicFolderSession called for folder id: {0}", folderId); bool flag = false; Guid hierarchyMailboxGuidForUser = this.GetHierarchyMailboxGuidForUser(); if (this.firstPublicFolderSession != null && this.firstPublicFolderSession.MailboxGuid != hierarchyMailboxGuidForUser) { try { using (Folder folder = Folder.Bind(this.firstPublicFolderSession, folderId)) { flag = true; if (folder.IsContentAvailable()) { return(this.firstPublicFolderSession); } PublicFolderContentMailboxInfo contentMailboxInfo = folder.GetContentMailboxInfo(); if (!contentMailboxInfo.IsValid) { throw new InvalidOperationException(string.Format("IsContentAvailable() should have returned true if content mailbox property (value={0}) was not parse-able as a guid", contentMailboxInfo)); } return(this.GetPublicFolderSession(contentMailboxInfo.MailboxGuid)); } } catch (ObjectNotFoundException) { } } PublicFolderSession publicFolderSession = null; if (!flag) { publicFolderSession = this.GetPublicFolderHierarchySession(); using (Folder folder2 = Folder.Bind(publicFolderSession, folderId)) { if (!folder2.IsContentAvailable()) { PublicFolderContentMailboxInfo contentMailboxInfo2 = folder2.GetContentMailboxInfo(); if (!contentMailboxInfo2.IsValid) { throw new InvalidOperationException(string.Format("IsContentAvailable() should have returned true if content mailbox property (value={0}) was not parse-able as a guid", contentMailboxInfo2)); } return(this.GetPublicFolderSession(contentMailboxInfo2.MailboxGuid)); } } } result = publicFolderSession; } return(result); }