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)); }