// Token: 0x060001C0 RID: 448 RVA: 0x00010840 File Offset: 0x0000EA40
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            MessageItem           messageItem = null;
            PreFormActionResponse result;

            try
            {
                if (owaContext == null)
                {
                    throw new ArgumentNullException("owaContext");
                }
                applicationElement = ApplicationElement.NotSet;
                type   = string.Empty;
                action = string.Empty;
                state  = string.Empty;
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
                HttpContext           httpContext           = owaContext.HttpContext;
                HttpRequest           request     = httpContext.Request;
                UserContext           userContext = owaContext.UserContext;
                if (!Utilities.IsPostRequest(request))
                {
                    result = userContext.LastClientViewState.ToPreFormActionResponse();
                }
                else
                {
                    string formParameter  = Utilities.GetFormParameter(request, "hidid", false);
                    string formParameter2 = Utilities.GetFormParameter(request, "hidchk", false);
                    if (Utilities.IsPostRequest(request) && !string.IsNullOrEmpty(formParameter) && !string.IsNullOrEmpty(formParameter2))
                    {
                        messageItem = Utilities.GetItem <MessageItem>(userContext, formParameter, formParameter2, new PropertyDefinition[0]);
                    }
                    string formParameter3 = Utilities.GetFormParameter(request, "hidcmdpst", false);
                    if (!string.IsNullOrEmpty(formParameter3))
                    {
                        if (messageItem == null)
                        {
                            messageItem = EditMessageHelper.CreateDraft(userContext);
                        }
                        string text = null;
                        string key;
                        switch (key = formParameter3)
                        {
                        case "snd":
                        {
                            bool flag = EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            if (!flag && Utilities.GetFormParameter(request, "hidunrslrcp", false) == "1")
                            {
                                flag = true;
                            }
                            if (flag)
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, LocalizedStrings.GetNonEncoded(-2019438132), messageItem);
                                goto IL_2EA;
                            }
                            text = EditMessageHelper.SendMessage(userContext, messageItem);
                            if (text != null)
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            userContext.ForceNewSearch = true;
                            preFormActionResponse      = userContext.LastClientViewState.ToPreFormActionResponse();
                            goto IL_2EA;
                        }

                        case "cls":
                            preFormActionResponse = userContext.LastClientViewState.ToPreFormActionResponse();
                            goto IL_2EA;

                        case "attch":
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            EditMessagePreFormAction.RedirectToAttachmentManager(owaContext, preFormActionResponse, messageItem);
                            goto IL_2EA;

                        case "addrBook":
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            preFormActionResponse = EditMessageHelper.RedirectToPeoplePicker(owaContext, messageItem, AddressBook.Mode.EditMessage);
                            goto IL_2EA;

                        case "viewRcptWhenEdt":
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            preFormActionResponse = EditMessageHelper.RedirectToRecipient(owaContext, messageItem, AddressBook.Mode.EditMessage);
                            goto IL_2EA;

                        case "autoSave":
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                preFormActionResponse.AddParameter("aserr", "1");
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            preFormActionResponse = this.RedirectToAutoSaveInfo(owaContext, messageItem);
                            goto IL_2EA;
                        }
                        throw new OwaInvalidRequestException("Invalid command form parameter");
                    }
IL_2EA:
                    result = preFormActionResponse;
                }
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                }
            }
            return(result);
        }
示例#2
0
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            HttpContext httpContext = owaContext.HttpContext;
            HttpRequest request     = httpContext.Request;
            UserContext userContext = owaContext.UserContext;

            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            string      formParameter  = Utilities.GetFormParameter(request, "hidid", true);
            string      formParameter2 = Utilities.GetFormParameter(request, "hidchk", true);
            string      formParameter3 = Utilities.GetFormParameter(request, "hidcmdpst", true);
            MessageItem messageItem    = null;

            try
            {
                if (string.CompareOrdinal(formParameter3, "cls") != 0 && Utilities.IsPostRequest(request))
                {
                    if (ObjectClass.IsMeetingRequest(owaContext.FormsRegistryContext.Type))
                    {
                        messageItem = Utilities.GetItem <MeetingRequest>(userContext, formParameter, formParameter2, new PropertyDefinition[0]);
                    }
                    else if (ObjectClass.IsMeetingCancellation(owaContext.FormsRegistryContext.Type))
                    {
                        messageItem = Utilities.GetItem <MeetingCancellation>(userContext, formParameter, formParameter2, new PropertyDefinition[0]);
                    }
                    else
                    {
                        if (!ObjectClass.IsMeetingResponse(owaContext.FormsRegistryContext.Type))
                        {
                            throw new OwaInvalidRequestException("Invalid Type");
                        }
                        messageItem = Utilities.GetItem <MeetingResponse>(userContext, formParameter, formParameter2, new PropertyDefinition[0]);
                    }
                    this.base64ItemId = messageItem.Id.ObjectId.ToBase64String();
                }
                string text = null;
                string a;
                if ((a = formParameter3) != null)
                {
                    if (!(a == "snd"))
                    {
                        if (a == "cls")
                        {
                            return(userContext.LastClientViewState.ToPreFormActionResponse());
                        }
                        if (!(a == "attch"))
                        {
                            if (!(a == "addrBook"))
                            {
                                if (a == "viewRcptWhenEdt")
                                {
                                    EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                                    if (!string.IsNullOrEmpty(text))
                                    {
                                        return(this.RedirectToCompose(owaContext, text));
                                    }
                                    return(EditMessageHelper.RedirectToRecipient(owaContext, messageItem, AddressBook.Mode.EditMeetingResponse));
                                }
                            }
                            else
                            {
                                EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                                if (!string.IsNullOrEmpty(text))
                                {
                                    return(this.RedirectToCompose(owaContext, text));
                                }
                                return(EditMessageHelper.RedirectToPeoplePicker(owaContext, messageItem, AddressBook.Mode.EditMeetingResponse));
                            }
                        }
                        else
                        {
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                return(this.RedirectToCompose(owaContext, text));
                            }
                            return(this.RedirectToAttachmentManager(owaContext));
                        }
                    }
                    else
                    {
                        StoreObjectId   storeObjectId   = null;
                        MeetingResponse meetingResponse = messageItem as MeetingResponse;
                        if (meetingResponse != null)
                        {
                            storeObjectId = meetingResponse.AssociatedMeetingRequestId;
                        }
                        bool flag = EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                        if (!string.IsNullOrEmpty(text))
                        {
                            return(this.RedirectToCompose(owaContext, text));
                        }
                        if (!flag && Utilities.GetFormParameter(request, "hidunrslrcp", false) == "1")
                        {
                            flag = true;
                        }
                        if (flag)
                        {
                            return(this.RedirectToCompose(owaContext, LocalizedStrings.GetNonEncoded(-2019438132)));
                        }
                        text = EditMessageHelper.SendMessage(userContext, messageItem);
                        if (text != null)
                        {
                            return(this.RedirectToCompose(owaContext, text));
                        }
                        if (storeObjectId != null)
                        {
                            StoreObjectId storeObjectId2 = null;
                            using (MeetingRequest item = Utilities.GetItem <MeetingRequest>(userContext, storeObjectId, new PropertyDefinition[0]))
                            {
                                storeObjectId2 = item.ParentId;
                            }
                            if (storeObjectId2 != null)
                            {
                                if (Utilities.IsDefaultFolderId(userContext.MailboxSession, storeObjectId2, DefaultFolderType.DeletedItems))
                                {
                                    Utilities.DeleteItems(userContext, DeleteItemFlags.SoftDelete, new StoreId[]
                                    {
                                        storeObjectId
                                    });
                                }
                                else
                                {
                                    Utilities.DeleteItems(userContext, DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                                    {
                                        storeObjectId
                                    });
                                }
                            }
                        }
                        userContext.ForceNewSearch = true;
                        return(userContext.LastClientViewState.ToPreFormActionResponse());
                    }
                }
                throw new OwaInvalidRequestException("Invalid command form parameter");
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                }
            }
            PreFormActionResponse result;

            return(result);
        }