public static OwaStoreObjectId CreateFromNavigationNodeFolder(UserContext userContext, NavigationNodeFolder nodeFolder) { if (userContext == null) { throw new ArgumentNullException("userContext"); } if (nodeFolder == null) { throw new ArgumentNullException("nodeFolder"); } if (!nodeFolder.IsValid) { throw new ArgumentException("Not valid navigation node folder."); } if (!nodeFolder.IsGSCalendar && nodeFolder.FolderId == null) { throw new NotSupportedException("Doesn't support this kind of node folder"); } if (nodeFolder.IsFolderInSpecificMailboxSession(userContext.MailboxSession)) { return(OwaStoreObjectId.CreateFromMailboxFolderId(nodeFolder.FolderId)); } if (nodeFolder.IsGSCalendar) { return(OwaStoreObjectId.CreateFromGSCalendarLegacyDN(nodeFolder.MailboxLegacyDN)); } ExchangePrincipal exchangePrincipal; if (userContext.DelegateSessionManager.TryGetExchangePrincipal(nodeFolder.MailboxLegacyDN, out exchangePrincipal) && exchangePrincipal.MailboxInfo.IsArchive) { return(OwaStoreObjectId.CreateFromArchiveMailboxFolderId(nodeFolder.FolderId, nodeFolder.MailboxLegacyDN)); } return(OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(nodeFolder.FolderId, nodeFolder.MailboxLegacyDN)); }
public static OwaStoreObjectId CreateFromSessionFolderId(OwaStoreObjectIdType owaStoreObjectIdType, string legacyDN, StoreObjectId folderId) { if (folderId == null) { throw new ArgumentNullException("folderId"); } switch (owaStoreObjectIdType) { case OwaStoreObjectIdType.MailBoxObject: return(OwaStoreObjectId.CreateFromMailboxFolderId(folderId)); case OwaStoreObjectIdType.PublicStoreFolder: return(OwaStoreObjectId.CreateFromPublicFolderId(folderId)); case OwaStoreObjectIdType.OtherUserMailboxObject: return(OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(folderId, legacyDN)); case OwaStoreObjectIdType.ArchiveMailboxObject: return(OwaStoreObjectId.CreateFromArchiveMailboxFolderId(folderId, legacyDN)); } throw new ArgumentException("mailbox session type is unknown"); }