Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        internal NavigationNodeFolder InsertToDoFolderToGroup(UserContext userContext)
        {
            this.ThrowIfSaved();
            if (this.GroupSection != NavigationNodeGroupSection.Tasks)
            {
                throw new InvalidOperationException("Only task module can accept todo folder.");
            }
            NavigationNodeFolder result;

            using (Folder folder = Utilities.GetFolder <Folder>(userContext, OwaStoreObjectId.CreateFromMailboxFolderId(userContext.FlaggedItemsAndTasksFolderId), new PropertyDefinition[]
            {
                StoreObjectSchema.RecordKey
            }))
            {
                result = this.AddFolderToGroup(this.GetDefaultGroup(NavigationNodeGroupType.MyFoldersGroup), 0, folder, userContext, folder.DisplayName, NavigationNodeType.NormalFolder);
            }
            return(result);
        }
Ejemplo n.º 3
0
        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");
        }
        // Token: 0x06001915 RID: 6421 RVA: 0x00091B28 File Offset: 0x0008FD28
        private Folder ProcessWebPartRequest()
        {
            this.webPartParameters = this.LoadWebPartParameters();
            Folder result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                Folder folder = null;
                string text   = this.webPartParameters["fPath"];
                bool   flag   = string.Compare(this.webPartParameters["module"], "publicfolders", true) == 0;
                if (this.owaContext.IsExplicitLogon && flag)
                {
                    this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(1044509156), OwaEventHandlerErrorCode.WebPartExplicitLogonPublicFolderViaOwaBasicError);
                    result = null;
                }
                else if (flag && !this.userContext.IsFeatureEnabled(Feature.PublicFolders))
                {
                    this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(-1242252459), OwaEventHandlerErrorCode.WebPartSegmentationError);
                    result = null;
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.webPartParameters["id"]))
                    {
                        OwaStoreObjectId folderId = this.GetFolderId(this.webPartParameters["id"], flag);
                        if (folderId == null || !Folder.IsFolderId(folderId.StoreObjectId))
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(-1323257605), OwaEventHandlerErrorCode.WebPartUnsupportedItemError);
                        }
                        else
                        {
                            folder = this.GetFolderFromId(folderId);
                            if (folder == null)
                            {
                                this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(1725230116), OwaEventHandlerErrorCode.WebPartFolderPathError);
                            }
                        }
                    }
                    else if (!string.IsNullOrEmpty(text))
                    {
                        folder = this.GetFolderFromPath(text, flag);
                        if (folder == null)
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(1725230116), OwaEventHandlerErrorCode.WebPartFolderPathError);
                        }
                    }
                    else if (!string.IsNullOrEmpty(this.webPartParameters["module"]))
                    {
                        if (!WebPartPreFormAction.IsSupportedModule(this.webPartParameters["module"]))
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(string.Format(Strings.WebPartInvalidParameterError, "module"), OwaEventHandlerErrorCode.WebPartInvalidParameterError);
                        }
                        else
                        {
                            folder = this.GetFolderFromModule(this.webPartParameters["module"]);
                            if (folder == null)
                            {
                                this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(1725230116), OwaEventHandlerErrorCode.WebPartFolderPathError);
                            }
                        }
                    }
                    else
                    {
                        StoreObjectId storeObjectId = this.userContext.TryGetMyDefaultFolderId(DefaultFolderType.Inbox);
                        if (storeObjectId == null)
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(-1925343075), OwaEventHandlerErrorCode.WebPartContentsPermissionsError);
                        }
                        else
                        {
                            folder = this.GetFolderFromId(OwaStoreObjectId.CreateFromMailboxFolderId(storeObjectId));
                            if (folder == null)
                            {
                                this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(-1925343075), OwaEventHandlerErrorCode.WebPartContentsPermissionsError);
                            }
                        }
                    }
                    if (folder == null)
                    {
                        result = null;
                    }
                    else
                    {
                        disposeGuard.Add <Folder>(folder);
                        if (!this.CheckFolderIsSupported(folder))
                        {
                            result = null;
                        }
                        else if (!string.IsNullOrEmpty(this.webPartParameters["view"]) && !this.IsViewValid(folder.Id.ObjectId.ObjectType))
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(string.Format(Strings.WebPartInvalidParameterError, "view"), OwaEventHandlerErrorCode.WebPartInvalidParameterError);
                            result = null;
                        }
                        else
                        {
                            if (ObjectClass.IsCalendarFolder(folder.ClassName) && (!string.IsNullOrEmpty(this.webPartParameters["d"]) || !string.IsNullOrEmpty(this.webPartParameters["m"]) || !string.IsNullOrEmpty(this.webPartParameters["y"])))
                            {
                                this.isoDateString = WebPartUtilities.ValidateDate(this.webPartParameters["d"], this.webPartParameters["m"], this.webPartParameters["y"]);
                                if (this.isoDateString == null)
                                {
                                    this.owaContext.ErrorInformation = new ErrorInformation(string.Format(LocalizedStrings.GetNonEncoded(-1413211833), "m, d, y"), OwaEventHandlerErrorCode.WebPartInvalidParameterError);
                                    return(null);
                                }
                            }
                            if (this.IsBasicClient())
                            {
                                this.webPartParameters["part"] = "1";
                            }
                            disposeGuard.Success();
                            result = folder;
                        }
                    }
                }
            }
            return(result);
        }