internal void FixLegacyDNRelatedFlag(MailboxSession mailboxSession) { bool flag = string.Equals(mailboxSession.MailboxOwner.LegacyDn, this.GetLegacyDNFromStoreEntryId(), StringComparison.OrdinalIgnoreCase); if (base.IsFlagSet(NavigationNodeFlags.IsDefaultStore)) { if (!flag) { this.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(mailboxSession.MailboxOwner); return; } } else if (flag) { base.NavigationNodeFlags |= NavigationNodeFlags.IsDefaultStore; } }
private string GetLegacyDNFromStoreEntryId() { string text = null; byte[] valueOrDefault = this.propertyBag.GetValueOrDefault <byte[]>(NavigationNodeSchema.StoreEntryId); if (valueOrDefault != null) { text = StoreEntryId.TryParseStoreEntryIdMailboxDN(valueOrDefault); if (text == null) { text = StoreEntryId.TryParseMailboxLegacyDN(valueOrDefault); } if (string.IsNullOrEmpty(text) || !Utilities.IsValidLegacyDN(text)) { text = string.Empty; } } return(text ?? string.Empty); }
private void Initialize(MailboxSession session, bool isMyMailbox, StoreObjectId folderId, object recordKey, ExtendedFolderFlags flags, Guid groupClassId, string groupName) { StoreObjectId storeObjectId = Utilities.TryGetDefaultFolderId(session, DefaultFolderType.Root); if (storeObjectId != null && storeObjectId.Equals(folderId)) { throw new NotSupportedException("We don't support adding root folder to favorites."); } if (!session.IsRemote) { this.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(session.MailboxOwner); } this.NavigationNodeEntryId = folderId.ProviderLevelItemId; if (recordKey is byte[]) { this.NavigationNodeRecordKey = (byte[])recordKey; } StoreObjectId storeObjectId2 = Utilities.TryGetDefaultFolderId(session, DefaultFolderType.ToDoSearch); if (storeObjectId2 != null && storeObjectId2.Equals(folderId)) { base.NavigationNodeFlags |= NavigationNodeFlags.TodoFolder; } foreach (KeyValuePair <ExtendedFolderFlags, NavigationNodeFlags> keyValuePair in NavigationNodeFolder.mappingFromFolderFlagToNodeFlag) { if (Utilities.IsFlagSet((int)flags, (int)keyValuePair.Key)) { base.NavigationNodeFlags |= keyValuePair.Value; } } if (isMyMailbox) { base.NavigationNodeFlags |= NavigationNodeFlags.IsDefaultStore; } if (!base.IsFavorites) { this.NavigationNodeParentGroupClassId = groupClassId; this.NavigationNodeGroupName = groupName; } }
internal static NavigationNodeFolder CreateGSNode(ExchangePrincipal exchangePrincipal, Guid groupClassId, string groupName, string subject, NavigationNodeGroupSection navigationNodeGroupSection) { NavigationNodeFolder navigationNodeFolder = new NavigationNodeFolder(subject, navigationNodeGroupSection); navigationNodeFolder.GSCalendarSharerAddressBookEntryId = AddressBookEntryId.MakeAddressBookEntryID(exchangePrincipal); UserContext userContext = OwaContext.Current.UserContext; navigationNodeFolder.GSCalendarShareeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(userContext.ExchangePrincipal); try { using (OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(exchangePrincipal, userContext)) { try { using (Folder folder = Folder.Bind(owaStoreObjectIdSessionHandle.Session as MailboxSession, DefaultFolderType.Calendar, new PropertyDefinition[] { StoreObjectSchema.EffectiveRights })) { if (CalendarUtilities.UserHasRightToLoad(folder)) { navigationNodeFolder.NavigationNodeEntryId = folder.StoreObjectId.ProviderLevelItemId; navigationNodeFolder.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(exchangePrincipal); } } } catch (ObjectNotFoundException) { } } } catch (OwaSharedFromOlderVersionException) { } navigationNodeFolder.ClearDirty(); return(navigationNodeFolder); }
public void AddSharedCalendar() { using (SharingMessageItem requestItem = base.GetRequestItem <SharingMessageItem>(new PropertyDefinition[0])) { if (requestItem == null || !requestItem.SharingMessageType.IsInvitationOrAcceptOfRequest || requestItem.SharedFolderType != DefaultFolderType.Calendar) { throw new OwaInvalidRequestException("Not a calendar sharing message"); } this.ValidateSharingAction(SharingAction.AddCalendar, requestItem); SubscribeResults subscribeResults = null; try { subscribeResults = requestItem.SubscribeAndOpen(); } catch (NotSupportedWithMailboxVersionException) { throw new OwaInvalidRequestException("Your account isn't set up to allow calendars to be added from the Internet."); } catch (StoragePermanentException ex) { string message = string.Format("Unable to subscribe shared calendar folder. Exception {0}", ex.Message); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message); this.RenderSubscriptionError(ex); return; } if (subscribeResults is SubscribeResultsInternal) { SubscribeResultsInternal subscribeResultsInternal = (SubscribeResultsInternal)subscribeResults; string text = StoreEntryId.TryParseMailboxLegacyDN(subscribeResultsInternal.RemoteMailboxId); ExchangePrincipal exchangePrincipal; if (base.UserContext.DelegateSessionManager.TryGetExchangePrincipal(text, out exchangePrincipal)) { try { if (requestItem.IsSharedFolderPrimary) { if (!string.Equals(text, base.UserContext.MailboxOwnerLegacyDN, StringComparison.OrdinalIgnoreCase)) { NavigationNodeCollection.AddGSCalendarToSharedFoldersGroup(base.UserContext, exchangePrincipal); } } else { using (OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(exchangePrincipal, base.UserContext)) { OwaStoreObjectId folderId = OwaStoreObjectId.CreateFromSessionFolderId(base.UserContext, owaStoreObjectIdSessionHandle.Session, subscribeResultsInternal.RemoteFolderId); using (Folder folder = Utilities.GetFolder <Folder>(base.UserContext, folderId, FolderList.FolderTreeQueryProperties)) { if (!Utilities.CanReadItemInFolder(folder)) { this.RenderNotFoundResponse(); return; } NavigationNodeCollection.AddNonMailFolderToSharedFoldersGroup(base.UserContext, folder, NavigationNodeGroupSection.Calendar); } } } goto IL_1A2; } catch (OwaSharedFromOlderVersionException) { this.RenderSharedFromE12Response(); return; } catch (ObjectNotFoundException) { this.RenderNotFoundResponse(); return; } } this.RenderNotFoundResponse(); return; } if (subscribeResults is SubscribeResultsExternal) { OwaStoreObjectId folderId = OwaStoreObjectId.CreateFromMailboxFolderId(((SubscribeResultsExternal)subscribeResults).LocalFolderId); } IL_1A2: this.RenderChangeKey(requestItem); ExDateTime now = ExDateTime.GetNow(base.UserContext.TimeZone); this.Writer.Write("<div id=\"subInfo\">"); this.Writer.Write(SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(388258761), new object[] { now.ToString(base.UserContext.UserOptions.DateFormat), now.ToString(base.UserContext.UserOptions.TimeFormat) })); this.Writer.Write("</div>"); RenderingUtilities.RenderNavigationTreeDirtyFlag(this.Writer, base.UserContext, NavigationTreeDirtyFlag.Calendar, new NavigationModule[] { NavigationModule.Calendar }); } }
private string GetGSCalendarShareeLegacyDN() { return(StoreEntryId.TryParseMailboxLegacyDN(this.GSCalendarShareeStoreEntryId)); }