public override PreFormActionResponse ToPreFormActionResponse()
        {
            PreFormActionResponse preFormActionResponse = base.ToPreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.WebPartFolder;
            return(preFormActionResponse);
        }
        // Token: 0x06000300 RID: 768 RVA: 0x0001AF0C File Offset: 0x0001910C
        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.NotSet;
            type   = null;
            state  = null;
            action = null;
            HttpRequest request     = owaContext.HttpContext.Request;
            UserContext userContext = owaContext.UserContext;

            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            string             type2 = owaContext.FormsRegistryContext.Type;
            NavigationModule   navigationModuleFromStoreType   = MoveItemHelper.GetNavigationModuleFromStoreType(type2);
            ApplicationElement applicationElementFromStoreType = MoveItemHelper.GetApplicationElementFromStoreType(type2);

            if ((navigationModuleFromStoreType == NavigationModule.Calendar && !userContext.IsFeatureEnabled(Feature.Calendar)) || (navigationModuleFromStoreType == NavigationModule.Contacts && !userContext.IsFeatureEnabled(Feature.Contacts)))
            {
                throw new OwaSegmentationException("The " + type + " feature is disabled");
            }
            StoreObjectId[] storeObjectIdsFromForm        = RequestParser.GetStoreObjectIdsFromForm(request, true);
            StoreObjectId   folderIdFromQueryString       = RequestParser.GetFolderIdFromQueryString(request, true);
            StoreObjectId   targetFolderIdFromQueryString = RequestParser.GetTargetFolderIdFromQueryString(request, true);
            string          formParameter = Utilities.GetFormParameter(request, "hidt");

            string[] array = formParameter.Split(new char[]
            {
                ','
            });
            if (array.Length != storeObjectIdsFromForm.Length)
            {
                throw new OwaInvalidRequestException("The counts of the items and their types are not identical.");
            }
            ItemOperations.Result result = null;
            if (navigationModuleFromStoreType == NavigationModule.Mail && applicationElementFromStoreType == ApplicationElement.Item)
            {
                result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Delete, storeObjectIdsFromForm[0], folderIdFromQueryString);
            }
            if (!MoveItemPreFormAction.DoMove(targetFolderIdFromQueryString, storeObjectIdsFromForm, array, owaContext))
            {
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
                preFormActionResponse.ApplicationElement = ApplicationElement.Dialog;
                preFormActionResponse.Type   = owaContext.FormsRegistryContext.Type;
                preFormActionResponse.Action = owaContext.FormsRegistryContext.Action;
                preFormActionResponse.AddParameter("fid", folderIdFromQueryString.ToBase64String());
                return(preFormActionResponse);
            }
            if (result != null)
            {
                owaContext[OwaContextProperty.InfobarMessage] = null;
            }
            userContext.ForceNewSearch = true;
            return(ItemOperations.GetPreFormActionResponse(userContext, result));
        }
Example #3
0
        // Token: 0x06000225 RID: 549 RVA: 0x00013E08 File Offset: 0x00012008
        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.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            Item item  = null;
            Item item2 = null;
            Item item3 = null;

            try
            {
                HttpContext httpContext = owaContext.HttpContext;
                UserContext userContext = owaContext.UserContext;
                item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2);
                if (!(item is CalendarItemBase) && !(item is MessageItem))
                {
                    item3 = ReplyForwardUtilities.CreateForwardMessageWithItemAttached(item, userContext);
                }
                else
                {
                    item3 = ReplyForwardUtilities.CreateForwardItem(BodyFormat.TextPlain, item, ReplyForwardFlags.None, userContext, Utilities.GetParentFolderId(item2, item));
                }
                AttachmentUtility.PromoteInlineAttachments(item3);
                item3.Save(SaveMode.ResolveConflicts);
                item3.Load();
                ReplyForwardUtilities.DeleteLevelOneAttachments(item3, userContext);
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = item3.ClassName;
                preFormActionResponse.Action = "Forward";
                preFormActionResponse.AddParameter("id", item3.Id.ObjectId.ToBase64String());
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(preFormActionResponse);
        }
Example #4
0
        public override PreFormActionResponse ToPreFormActionResponse()
        {
            PreFormActionResponse preFormActionResponse = base.ToPreFormActionResponse();

            preFormActionResponse.AddParameter("yr", this.dateTime.Year.ToString());
            preFormActionResponse.AddParameter("mn", this.dateTime.Month.ToString());
            preFormActionResponse.AddParameter("dy", this.dateTime.Day.ToString());
            return(preFormActionResponse);
        }
        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.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            Item item  = null;
            Item item2 = null;
            Item item3 = null;

            try
            {
                HttpContext httpContext = owaContext.HttpContext;
                UserContext userContext = owaContext.UserContext;
                item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2);
                if (!(item is CalendarItemBase) && !(item is MessageItem))
                {
                    throw new OwaInvalidRequestException("Item is not supported for reply");
                }
                if (item is ReportMessage)
                {
                    Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(2128562495));
                }
                item3 = ReplyForwardUtilities.CreateReplyItem(BodyFormat.TextPlain, item, ReplyForwardFlags.None, userContext, null);
                AttachmentUtility.PromoteInlineAttachments(item3);
                item3.Save(SaveMode.ResolveConflicts);
                item3.Load();
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Note";
                preFormActionResponse.Action = "Reply";
                preFormActionResponse.AddParameter("id", item3.Id.ObjectId.ToBase64String());
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(preFormActionResponse);
        }
Example #6
0
        private PreFormActionResponse RedirectToAttachmentManager(OwaContext owaContext)
        {
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Dialog;
            preFormActionResponse.Type = "Attach";
            preFormActionResponse.AddParameter("id", this.base64ItemId);
            return(preFormActionResponse);
        }
Example #7
0
        public override PreFormActionResponse ToPreFormActionResponse()
        {
            PreFormActionResponse preFormActionResponse = base.ToPreFormActionResponse();

            if (this.pageNumber > 0)
            {
                preFormActionResponse.AddParameter("pg", this.pageNumber.ToString());
            }
            return(preFormActionResponse);
        }
Example #8
0
        public override PreFormActionResponse ToPreFormActionResponse()
        {
            PreFormActionResponse preFormActionResponse  = base.ToPreFormActionResponse();
            PreFormActionResponse preFormActionResponse2 = preFormActionResponse;
            string name = "slUsng";
            int    num  = (int)this.selectedUsing;

            preFormActionResponse2.AddParameter(name, num.ToString());
            return(preFormActionResponse);
        }
        // Token: 0x060001C3 RID: 451 RVA: 0x00010BFC File Offset: 0x0000EDFC
        private PreFormActionResponse RedirectToAutoSaveInfo(OwaContext owaContext, MessageItem message)
        {
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.Type   = "IPM.Note";
            preFormActionResponse.Action = "AutoSaveInfo";
            preFormActionResponse.State  = string.Empty;
            preFormActionResponse.AddParameter("id", message.Id.ObjectId.ToBase64String());
            return(preFormActionResponse);
        }
 // Token: 0x060001C1 RID: 449 RVA: 0x00010B64 File Offset: 0x0000ED64
 private static void RedirectToCompose(OwaContext owaContext, PreFormActionResponse response, string errorMessage, MessageItem message)
 {
     if (!string.IsNullOrEmpty(errorMessage))
     {
         owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateText(errorMessage, InfobarMessageType.Error);
     }
     response.ApplicationElement = ApplicationElement.Item;
     response.Type   = "IPM.Note";
     response.Action = "Open";
     response.State  = "Draft";
     response.AddParameter("id", message.Id.ObjectId.ToBase64String());
 }
Example #11
0
        public override PreFormActionResponse ToPreFormActionResponse()
        {
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Folder;
            preFormActionResponse.Type = this.FolderType;
            if (this.FolderId != null)
            {
                preFormActionResponse.AddParameter("id", this.FolderId.ToBase64String());
            }
            return(preFormActionResponse);
        }
Example #12
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;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            Item item  = null;
            Item item2 = null;
            Item item3 = null;

            try
            {
                HttpContext httpContext          = owaContext.HttpContext;
                UserContext userContext          = owaContext.UserContext;
                string      queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "fId", true);
                item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2);
                BodyFormat replyForwardBodyFormat = ReplyForwardUtilities.GetReplyForwardBodyFormat(item, userContext);
                item3 = ReplyForwardUtilities.CreatePostReplyItem(replyForwardBodyFormat, item as PostItem, userContext, Utilities.GetParentFolderId(item2, item));
                item3.Save(SaveMode.ResolveConflicts);
                item3.Load();
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Post";
                preFormActionResponse.Action = "PostReply";
                preFormActionResponse.AddParameter("Id", OwaStoreObjectId.CreateFromStoreObject(item3).ToBase64String());
                preFormActionResponse.AddParameter("fId", queryStringParameter);
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(preFormActionResponse);
        }
Example #13
0
        private PreFormActionResponse RedirectToCompose(OwaContext owaContext, string errorMessage)
        {
            if (!string.IsNullOrEmpty(errorMessage))
            {
                owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateText(errorMessage, InfobarMessageType.Error);
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.Type   = owaContext.FormsRegistryContext.Type;
            preFormActionResponse.Action = "Open";
            preFormActionResponse.State  = "Draft";
            preFormActionResponse.AddParameter("id", this.base64ItemId);
            return(preFormActionResponse);
        }
Example #14
0
        public override PreFormActionResponse ToPreFormActionResponse()
        {
            PreFormActionResponse preFormActionResponse = base.ToPreFormActionResponse();

            if (!string.IsNullOrEmpty(this.searchString))
            {
                preFormActionResponse.AddParameter("sch", this.searchString);
                if (!string.IsNullOrEmpty(this.searchLocation))
                {
                    preFormActionResponse.AddParameter("ab", this.searchLocation);
                }
                string value = OwaContext.Current.UserContext.Key.Canary.CloneRenewed().ToString();
                preFormActionResponse.AddParameter("canary", value);
            }
            return(preFormActionResponse);
        }
Example #15
0
        // Token: 0x06000116 RID: 278 RVA: 0x000094D0 File Offset: 0x000076D0
        public override PreFormActionResponse ToPreFormActionResponse()
        {
            PreFormActionResponse preFormActionResponse = base.ToPreFormActionResponse();

            if (!string.IsNullOrEmpty(this.SearchString))
            {
                preFormActionResponse.AddParameter("sch", this.SearchString);
                PreFormActionResponse preFormActionResponse2 = preFormActionResponse;
                string name = "scp";
                int    num  = (int)this.searchScope;
                preFormActionResponse2.AddParameter(name, num.ToString());
                string value = OwaContext.Current.UserContext.Key.Canary.CloneRenewed().ToString();
                preFormActionResponse.AddParameter("canary", value);
            }
            return(preFormActionResponse);
        }
        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.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            HttpContext           httpContext           = owaContext.HttpContext;
            string            queryStringParameter      = Utilities.GetQueryStringParameter(httpContext.Request, "lDn", true);
            IRecipientSession recipientSession          = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, owaContext.UserContext);

            Result <ADRawEntry>[] array = recipientSession.FindByLegacyExchangeDNs(new string[]
            {
                queryStringParameter
            }, ItemReadADObjectPreFormAction.recipientQueryProperties);
            if (array == null || array.Length != 1)
            {
                throw new OwaADObjectNotFoundException();
            }
            ADRawEntry data       = array[0].Data;
            ADObjectId adobjectId = null;

            if (data != null)
            {
                adobjectId = (ADObjectId)data[ADObjectSchema.Id];
            }
            if (adobjectId == null)
            {
                throw new OwaADObjectNotFoundException();
            }
            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.Action             = string.Empty;
            preFormActionResponse.AddParameter("id", Convert.ToBase64String(adobjectId.ObjectGuid.ToByteArray()));
            if (Utilities.IsADDistributionList((MultiValuedProperty <string>)data[ADObjectSchema.ObjectClass]))
            {
                preFormActionResponse.Type = "ADDistList";
            }
            else
            {
                preFormActionResponse.Type = "AD.RecipientType.User";
            }
            return(preFormActionResponse);
        }
Example #17
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.NotSet;
            type   = string.Empty;
            state  = string.Empty;
            action = string.Empty;
            Item item  = null;
            Item item2 = null;
            PreFormActionResponse result;

            try
            {
                item = Utilities.GetItemForRequest <Item>(owaContext, out item2, new PropertyDefinition[]
                {
                    StoreObjectSchema.EffectiveRights
                });
                bool flag = ItemUtility.UserCanEditItem(item);
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = owaContext.FormsRegistryContext.Type;
                preFormActionResponse.AddParameter("id", Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "id"));
                if (flag)
                {
                    preFormActionResponse.Action = "Open";
                    preFormActionResponse.State  = "Draft";
                }
                result = preFormActionResponse;
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
            }
            return(result);
        }
Example #18
0
        public static PreFormActionResponse GetPreFormActionResponse(UserContext userContext, ItemOperations.Result result)
        {
            if (result == null)
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.AddParameter("id", result.ItemId.ToBase64String());
            if (!Utilities.IsDefaultFolderId(userContext.MailboxSession, result.FolderId, DefaultFolderType.JunkEmail))
            {
                using (Item item = Item.Bind(userContext.MailboxSession, result.ItemId, new PropertyDefinition[]
                {
                    StoreObjectSchema.ItemClass,
                    MessageItemSchema.IsDraft,
                    CalendarItemBaseSchema.IsMeeting,
                    CalendarItemBaseSchema.IsOrganizer
                }))
                {
                    preFormActionResponse.Type = item.ClassName;
                    if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(item.ClassName))
                    {
                        if (ItemUtility.GetProperty <bool>(item, CalendarItemBaseSchema.IsMeeting, false) && !ItemUtility.GetProperty <bool>(item, CalendarItemBaseSchema.IsOrganizer, false))
                        {
                            preFormActionResponse.Action = "Read";
                        }
                        else
                        {
                            preFormActionResponse.Action = "Open";
                        }
                    }
                    else if ((ObjectClass.IsMessage(item.ClassName, false) || ObjectClass.IsMeetingMessage(item.ClassName)) && ItemUtility.GetProperty <bool>(item, MessageItemSchema.IsDraft, false))
                    {
                        preFormActionResponse.Action = "Open";
                        preFormActionResponse.State  = "Draft";
                    }
                }
            }
            return(preFormActionResponse);
        }
Example #19
0
        public static PreFormActionResponse RedirectToEdit(UserContext userContext, Item item, AddressBook.Mode viewMode)
        {
            AddressBookViewState addressBookViewState = userContext.LastClientViewState as AddressBookViewState;

            if (addressBookViewState != null)
            {
                userContext.LastClientViewState = addressBookViewState.PreviousViewState;
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            if (item.Id != null)
            {
                preFormActionResponse.AddParameter("id", item.Id.ObjectId.ToBase64String());
            }
            preFormActionResponse.Action = "Open";
            if (viewMode == AddressBook.Mode.EditMessage || viewMode == AddressBook.Mode.EditMeetingResponse)
            {
                preFormActionResponse.State = "Draft";
            }
            preFormActionResponse.Type = item.ClassName;
            return(preFormActionResponse);
        }
        // Token: 0x060001ED RID: 493 RVA: 0x00012C00 File Offset: 0x00010E00
        private PreFormActionResponse ExecuteDeleteAction()
        {
            StoreObjectId         storeObjectId = RequestParser.GetStoreObjectId(this.httpRequest, "ftd", true, ParameterIn.Form);
            int                   num           = RequestParser.TryGetIntValueFromQueryString(this.httpRequest, "hd", 0);
            bool                  flag          = this.folderManagementHelper.Delete(storeObjectId, num == 1);
            PreFormActionResponse result        = new PreFormActionResponse();

            if (flag && this.folderId.Equals(storeObjectId))
            {
                switch (this.module)
                {
                case NavigationModule.Mail:
                    this.folderId = this.userContext.InboxFolderId;
                    this.userContext.LastClientViewState = new MessageModuleViewState(this.userContext.InboxFolderId, "IPF.Note", SecondaryNavigationArea.Special, 1);
                    break;

                case NavigationModule.Calendar:
                    this.folderId = this.userContext.CalendarFolderId;
                    this.userContext.LastClientViewState = new CalendarModuleViewState(this.userContext.CalendarFolderId, "IPF.Appointment", DateTimeUtilities.GetLocalTime().Date);
                    break;

                case NavigationModule.Contacts:
                    this.folderId = this.userContext.ContactsFolderId;
                    this.userContext.LastClientViewState = new ContactModuleViewState(this.userContext.ContactsFolderId, "IPF.Contact", 1);
                    break;

                default:
                    throw new OwaInvalidRequestException("Invalid module for folder management preformaction");
                }
            }
            if (flag)
            {
                FolderMruCache.DeleteFromCache(storeObjectId, this.userContext);
            }
            return(result);
        }
        // Token: 0x06000080 RID: 128 RVA: 0x00004FB0 File Offset: 0x000031B0
        public override PreFormActionResponse ToPreFormActionResponse()
        {
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Dialog;
            preFormActionResponse.Type = "AddressBook";
            PreFormActionResponse preFormActionResponse2 = preFormActionResponse;
            string name = "ctx";
            int    num  = (int)this.mode;

            preFormActionResponse2.AddParameter(name, num.ToString());
            if (this.pageNumber > 0)
            {
                preFormActionResponse.AddParameter("pg", this.pageNumber.ToString());
            }
            if (this.itemId != null)
            {
                preFormActionResponse.AddParameter("id", this.itemId.ToBase64String());
            }
            PreFormActionResponse preFormActionResponse3 = preFormActionResponse;
            string name2 = "rw";
            int    num2  = (int)this.recipientWell;

            preFormActionResponse3.AddParameter(name2, num2.ToString());
            PreFormActionResponse preFormActionResponse4 = preFormActionResponse;
            string name3 = "cid";
            int    num3  = (int)this.sortColumnId;

            preFormActionResponse4.AddParameter(name3, num3.ToString());
            PreFormActionResponse preFormActionResponse5 = preFormActionResponse;
            string name4 = "so";
            int    num4  = (int)this.sortOrder;

            preFormActionResponse5.AddParameter(name4, num4.ToString());
            return(preFormActionResponse);
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            UserContext userContext = owaContext.UserContext;
            HttpRequest request     = owaContext.HttpContext.Request;

            string[] array = null;
            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            string        formParameter = Utilities.GetFormParameter(request, "hidAB");
            int           num           = 0;
            StoreObjectId storeObjectId = null;
            string        changeKey     = null;

            string[] array2 = formParameter.Split(new char[]
            {
                ';'
            });
            if (array2 != null && array2.Length > 0)
            {
                if (string.CompareOrdinal(array2[0], "Ad") == 0)
                {
                    num = 1;
                }
                else
                {
                    if (string.CompareOrdinal(array2[0], "Con") != 0)
                    {
                        throw new OwaInvalidRequestException("Invalid search location for addressbook");
                    }
                    num = 2;
                }
            }
            string action2 = owaContext.FormsRegistryContext.Action;

            if (action2 == null)
            {
                throw new OwaInvalidRequestException("Action query string parameter is missing");
            }
            object obj = AddressBookPreFormAction.actionParser.Parse(action2);

            AddressBookPreFormAction.Action action3 = (AddressBookPreFormAction.Action)obj;
            string text = request.Form["chkRcpt"];

            if (!string.IsNullOrEmpty(text))
            {
                array = text.Split(new char[]
                {
                    ','
                });
            }
            AddressBook.Mode mode = AddressBookHelper.TryReadAddressBookMode(request, AddressBook.Mode.None);
            if (AddressBook.IsEditingMode(mode))
            {
                string formParameter2 = Utilities.GetFormParameter(request, "hidid", false);
                changeKey = Utilities.GetFormParameter(request, "hidchk", false);
                if (!string.IsNullOrEmpty(formParameter2))
                {
                    storeObjectId = Utilities.CreateStoreObjectId(userContext.MailboxSession, formParameter2);
                    if (storeObjectId == null)
                    {
                        throw new OwaInvalidRequestException("ItemId cannot be null");
                    }
                }
            }
            switch (action3)
            {
            case AddressBookPreFormAction.Action.Done:
                if (AddressBook.IsEditingMode(mode))
                {
                    using (Item item = AddressBookHelper.GetItem(userContext, mode, storeObjectId, changeKey))
                    {
                        if (array != null && array.Length > 0)
                        {
                            RecipientItemType type2          = RecipientItemType.To;
                            string            formParameter3 = Utilities.GetFormParameter(request, "hidrw");
                            if (!string.IsNullOrEmpty(formParameter3))
                            {
                                int num2;
                                if (!int.TryParse(formParameter3, out num2) || num2 < 1 || num2 > 3)
                                {
                                    type2 = RecipientItemType.To;
                                }
                                else
                                {
                                    type2 = (RecipientItemType)num2;
                                }
                            }
                            if (num == 1)
                            {
                                AddressBookHelper.AddRecipientsToDraft(array, item, type2, userContext);
                            }
                            else if (num == 2)
                            {
                                AddressBookHelper.AddContactsToDraft(item, type2, userContext, array);
                            }
                        }
                        preFormActionResponse = AddressBookHelper.RedirectToEdit(userContext, item, mode);
                        break;
                    }
                }
                throw new OwaInvalidRequestException("This action must be in editing mode");

            case AddressBookPreFormAction.Action.Mail:
                if (array != null && array.Length > 0)
                {
                    using (Item item2 = MessageItem.Create(userContext.MailboxSession, userContext.DraftsFolderId))
                    {
                        item2[ItemSchema.ConversationIndexTracking] = true;
                        if (num == 1)
                        {
                            AddressBookHelper.AddRecipientsToDraft(array, item2, RecipientItemType.To, userContext);
                        }
                        else if (num == 2)
                        {
                            AddressBookHelper.AddContactsToDraft(item2, RecipientItemType.To, userContext, array);
                        }
                        preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                        preFormActionResponse.Type   = "IPM.Note";
                        preFormActionResponse.Action = "Open";
                        preFormActionResponse.State  = "Draft";
                        preFormActionResponse.AddParameter("id", item2.Id.ObjectId.ToBase64String());
                        break;
                    }
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Note";
                preFormActionResponse.Action = "New";
                break;

            case AddressBookPreFormAction.Action.MeetingRequest:
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = "IPM.Appointment";
                if (array != null && array.Length > 0)
                {
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(userContext, userContext.CalendarFolderId))
                    {
                        calendarItemBase.IsMeeting = true;
                        if (num == 1)
                        {
                            AddressBookHelper.AddRecipientsToDraft(array, calendarItemBase, RecipientItemType.To, userContext);
                        }
                        else if (num == 2)
                        {
                            AddressBookHelper.AddContactsToDraft(calendarItemBase, RecipientItemType.To, userContext, array);
                        }
                        preFormActionResponse.Action = "Open";
                        EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                        break;
                    }
                }
                preFormActionResponse.AddParameter("mr", "1");
                preFormActionResponse.Action = "New";
                break;

            case AddressBookPreFormAction.Action.Close:
                if (AddressBook.IsEditingMode(mode))
                {
                    using (Item item3 = AddressBookHelper.GetItem(userContext, mode, storeObjectId, changeKey))
                    {
                        preFormActionResponse = AddressBookHelper.RedirectToEdit(userContext, item3, mode);
                        break;
                    }
                }
                throw new OwaInvalidRequestException("This action must be in editing mode");

            case AddressBookPreFormAction.Action.AddToContacts:
            {
                string type3 = "IPM.Contact";
                string text2 = null;
                if (array == null || array.Length != 1)
                {
                    throw new OwaInvalidRequestException("User must select some recipient to add and can only add one recipient to contacts at one time");
                }
                ADObjectId adobjectId = DirectoryAssistance.ParseADObjectId(array[0]);
                if (adobjectId == null)
                {
                    throw new OwaADObjectNotFoundException();
                }
                IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.FullyConsistent, true, userContext);
                ADRecipient       adrecipient      = recipientSession.Read(adobjectId);
                if (adrecipient == null)
                {
                    throw new OwaADObjectNotFoundException();
                }
                using (ContactBase contactBase = ContactUtilities.AddADRecipientToContacts(userContext, adrecipient))
                {
                    if (contactBase != null)
                    {
                        contactBase.Load();
                        text2 = contactBase.Id.ObjectId.ToBase64String();
                        type3 = contactBase.ClassName;
                    }
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = type3;
                if (text2 != null)
                {
                    preFormActionResponse.Action = "Open";
                    preFormActionResponse.State  = "Draft";
                    preFormActionResponse.AddParameter("id", text2);
                }
                else
                {
                    preFormActionResponse.Action = "New";
                }
                break;
            }

            default:
                throw new OwaInvalidRequestException("Invalid request for addressbook preformaction");
            }
            return(preFormActionResponse);
        }
        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.NotSet;
            type   = string.Empty;
            state  = string.Empty;
            action = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.Type = owaContext.FormsRegistryContext.Type;
            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            bool flag  = false;
            bool flag2 = false;
            CalendarItemBaseData calendarItemBaseData = EditCalendarItemHelper.GetUserContextData(owaContext.UserContext);
            StoreObjectId        storeObjectId        = QueryStringUtilities.CreateItemStoreObjectId(owaContext.UserContext.MailboxSession, owaContext.HttpContext.Request, false);

            if (calendarItemBaseData != null && calendarItemBaseData.Id != null && storeObjectId != null && !calendarItemBaseData.Id.Equals(storeObjectId))
            {
                EditCalendarItemHelper.ClearUserContextData(owaContext.UserContext);
                calendarItemBaseData = null;
            }
            if (calendarItemBaseData != null)
            {
                flag  = calendarItemBaseData.IsOrganizer;
                flag2 = calendarItemBaseData.IsMeeting;
            }
            else
            {
                if (storeObjectId == null)
                {
                    throw new OwaLostContextException("Lost changes since last save.");
                }
                CalendarItemBase calendarItemBase2;
                CalendarItemBase calendarItemBase = calendarItemBase2 = CalendarItemBase.Bind(owaContext.UserContext.MailboxSession, storeObjectId);
                try
                {
                    flag  = calendarItemBase.IsOrganizer();
                    flag2 = calendarItemBase.IsMeeting;
                }
                finally
                {
                    if (calendarItemBase2 != null)
                    {
                        ((IDisposable)calendarItemBase2).Dispose();
                    }
                }
            }
            if (flag2 && !flag)
            {
                preFormActionResponse.Action = "Read";
            }
            else
            {
                preFormActionResponse.Action = "Open";
            }
            string text = "ae,a,t,s";

            for (int i = 0; i < owaContext.HttpContext.Request.QueryString.Count; i++)
            {
                string text2 = owaContext.HttpContext.Request.QueryString.Keys[i];
                if (text.IndexOf(text2, StringComparison.Ordinal) == -1)
                {
                    preFormActionResponse.AddParameter(text2, owaContext.HttpContext.Request.QueryString[text2]);
                }
            }
            return(preFormActionResponse);
        }
Example #24
0
        // Token: 0x06000127 RID: 295 RVA: 0x00009A0C File Offset: 0x00007C0C
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            UserContext userContext = owaContext.UserContext;
            HttpRequest request     = owaContext.HttpContext.Request;

            string[] array = null;
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            string queryStringParameter = Utilities.GetQueryStringParameter(request, "a", true);
            object obj = ContactViewPreFormAction.actionParser.Parse(queryStringParameter);

            ContactViewPreFormAction.Action action2 = (ContactViewPreFormAction.Action)obj;
            string text = request.Form["chkRcpt"];

            if (!string.IsNullOrEmpty(text))
            {
                array = text.Split(new char[]
                {
                    ','
                });
            }
            switch (action2)
            {
            case ContactViewPreFormAction.Action.Mail:
                if (array != null && array.Length > 0)
                {
                    using (MessageItem messageItem = MessageItem.Create(userContext.MailboxSession, userContext.DraftsFolderId))
                    {
                        messageItem[ItemSchema.ConversationIndexTracking] = true;
                        AddressBookHelper.AddContactsToDraft(messageItem, RecipientItemType.To, userContext, array);
                        preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                        preFormActionResponse.Type   = "IPM.Note";
                        preFormActionResponse.Action = "Open";
                        preFormActionResponse.State  = "Draft";
                        preFormActionResponse.AddParameter("id", messageItem.Id.ObjectId.ToBase64String());
                        break;
                    }
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Note";
                preFormActionResponse.Action = "New";
                break;

            case ContactViewPreFormAction.Action.MeetingRequest:
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = "IPM.Appointment";
                if (array != null && array.Length > 0)
                {
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(userContext, userContext.CalendarFolderId))
                    {
                        calendarItemBase.IsMeeting = true;
                        AddressBookHelper.AddContactsToDraft(calendarItemBase, RecipientItemType.To, userContext, array);
                        preFormActionResponse.Action = "Open";
                        EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                        break;
                    }
                }
                preFormActionResponse.AddParameter("mr", "1");
                preFormActionResponse.Action = "New";
                break;

            default:
                throw new OwaInvalidRequestException("Invalid request for addressbook preformaction");
            }
            return(preFormActionResponse);
        }
Example #25
0
        // Token: 0x060022C1 RID: 8897 RVA: 0x000C69B8 File Offset: 0x000C4BB8
        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.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            Item                  item       = null;
            Item                  item2      = null;
            Item                  item3      = null;
            bool                  flag       = false;
            BodyFormat            bodyFormat = BodyFormat.TextPlain;
            PreFormActionResponse result;

            try
            {
                HttpContext           httpContext           = owaContext.HttpContext;
                UserContext           userContext           = owaContext.UserContext;
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse(httpContext.Request, new string[]
                {
                    "cb",
                    "smime"
                });
                item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2);
                if (item != null && !ItemUtility.IsForwardSupported(item))
                {
                    throw new OwaInvalidRequestException("Forwarding of such a type item is not supported.");
                }
                CalendarItemBase calendarItemBase = item as CalendarItemBase;
                if (item is Task || item is ContactBase || (calendarItemBase != null && !calendarItemBase.IsMeeting))
                {
                    item3 = ReplyForwardUtilities.CreateForwardMessageWithItemAttached(item, userContext);
                    preFormActionResponse.Action = "New";
                    preFormActionResponse.AddParameter("exdltdrft", "1");
                }
                else
                {
                    bool   flag2 = false;
                    string queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "smime", false);
                    RightsManagedMessageDecryptionStatus decryptionStatus = RightsManagedMessageDecryptionStatus.FeatureDisabled;
                    if (userContext.IsIrmEnabled)
                    {
                        try
                        {
                            flag = Utilities.IrmDecryptForReplyForward(owaContext, ref item, ref item2, ref bodyFormat, out decryptionStatus);
                        }
                        catch (RightsManagementPermanentException exception)
                        {
                            decryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception);
                        }
                    }
                    if (!flag)
                    {
                        bodyFormat = ReplyForwardUtilities.GetReplyForwardBodyFormat(item, userContext);
                    }
                    bool flag3 = Utilities.IsSMimeControlNeededForEditForm(queryStringParameter, owaContext);
                    flag2 = ((flag3 && Utilities.IsSMime(item)) || flag);
                    bool flag4 = userContext.IsSmsEnabled && ObjectClass.IsSmsMessage(owaContext.FormsRegistryContext.Type);
                    ReplyForwardFlags replyForwardFlags = ReplyForwardFlags.None;
                    if (flag2)
                    {
                        replyForwardFlags |= ReplyForwardFlags.DropBody;
                    }
                    if (flag4 || flag)
                    {
                        replyForwardFlags |= ReplyForwardFlags.DropHeader;
                    }
                    StoreObjectId parentFolderId = Utilities.GetParentFolderId(item2, item);
                    item3 = ReplyForwardUtilities.CreateForwardItem(flag3 ? BodyFormat.TextHtml : bodyFormat, item, replyForwardFlags, userContext, parentFolderId);
                    if (flag)
                    {
                        item3.AttachmentCollection.RemoveAll();
                        using (ItemAttachment itemAttachment = item3.AttachmentCollection.AddExistingItem(item))
                        {
                            itemAttachment.Save();
                            goto IL_205;
                        }
                    }
                    if (Utilities.IsIrmRestrictedAndNotDecrypted(item))
                    {
                        ReplyForwardUtilities.SetAlternateIrmBody(item3, flag3 ? BodyFormat.TextHtml : bodyFormat, userContext, parentFolderId, decryptionStatus, ObjectClass.IsVoiceMessage(item.ClassName));
                        item3.AttachmentCollection.RemoveAll();
                    }
IL_205:
                    preFormActionResponse.Action = "Forward";
                    if (flag2)
                    {
                        preFormActionResponse.AddParameter("srcId", Utilities.GetItemIdQueryString(httpContext.Request));
                        if (Utilities.GetQueryStringParameter(httpContext.Request, "cb", false) == null && Utilities.IsWebBeaconsAllowed(item))
                        {
                            preFormActionResponse.AddParameter("cb", "1");
                        }
                    }
                    if (flag4)
                    {
                        item3.ClassName = "IPM.Note.Mobile.SMS";
                    }
                }
                item3.Save(SaveMode.ResolveConflicts);
                item3.Load();
                ReplyForwardUtilities.DeleteLevelOneAttachments(item3, userContext);
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = item3.ClassName;
                preFormActionResponse.AddParameter("id", OwaStoreObjectId.CreateFromStoreObject(item3).ToBase64String());
                if (userContext.IsInOtherMailbox(item))
                {
                    preFormActionResponse.AddParameter("fOMF", "1");
                }
                if (flag)
                {
                    preFormActionResponse.AddParameter("fIrmAsAttach", "1");
                }
                result = preFormActionResponse;
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(result);
        }
        private EditCalendarItemPreFormAction.RedirectTo DoAction(string commandPost, EditCalendarItemHelper.CalendarItemUpdateFlags storeUpdateFlags, ref PreFormActionResponse response, out InfobarMessage infobarMessage)
        {
            infobarMessage = null;
            EditCalendarItemHelper.CalendarItemUpdateFlags calendarItemUpdateFlags = EditCalendarItemHelper.CalendarItemUpdateFlags.None;
            string text = null;

            EditCalendarItemPreFormAction.CalendarTab calendarTab = (EditCalendarItemPreFormAction.CalendarTab)RequestParser.TryGetIntValueFromForm(this.request, "hidtab", 0);
            if (Utilities.IsPostRequest(this.request) && !string.Equals(commandPost, "new", StringComparison.Ordinal) && !string.Equals(commandPost, "cls", StringComparison.Ordinal))
            {
                if (calendarTab == EditCalendarItemPreFormAction.CalendarTab.Scheduling)
                {
                    calendarItemUpdateFlags = EditCalendarItemHelper.UpdateImportance(this.calendarItemBase, this.request);
                }
                else
                {
                    calendarItemUpdateFlags = EditCalendarItemHelper.UpdateCalendarItemValues(this.calendarItemBase, this.userContext, this.request, out text);
                }
                if (!string.IsNullOrEmpty(text))
                {
                    infobarMessage = InfobarMessage.CreateText(text, InfobarMessageType.Error);
                    return(EditCalendarItemPreFormAction.RedirectTo.EditCalendarItem);
                }
                if (this.calendarItemBase.AttendeesChanged)
                {
                    calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.AttendeesChanged;
                }
            }
            EditCalendarItemHelper.CalendarItemUpdateFlags calendarItemUpdateFlags2 = calendarItemUpdateFlags | storeUpdateFlags;
            EditCalendarItemHelper.CancelRangeType         cancelRangeType          = EditCalendarItemHelper.CancelRangeType.None;
            ExDateTime cancelFromDateTime = ExDateTime.MinValue;
            string     formParameter      = Utilities.GetFormParameter(this.request, "delprompt", false);

            if (!string.IsNullOrEmpty(formParameter))
            {
                if (string.Equals(formParameter, "2", StringComparison.Ordinal))
                {
                    cancelRangeType = EditCalendarItemHelper.CancelRangeType.All;
                }
                else if (string.Equals(formParameter, "1", StringComparison.Ordinal))
                {
                    cancelRangeType    = EditCalendarItemHelper.CancelRangeType.FromDate;
                    cancelFromDateTime = CalendarUtilities.ParseDateTimeFromForm(this.request, "seldelY", "seldelM", "seldelD", null, this.userContext);
                }
                else
                {
                    if (!string.Equals(formParameter, "0", StringComparison.Ordinal))
                    {
                        throw new OwaInvalidRequestException("Invalid cancel prompt radio button value.");
                    }
                    cancelRangeType = EditCalendarItemHelper.CancelRangeType.Occurrence;
                }
            }
            EditCalendarItemPreFormAction.RedirectTo result = EditCalendarItemPreFormAction.RedirectTo.None;
            if (commandPost != null)
            {
                if (< PrivateImplementationDetails > { 83F 8DD 10 - 61AE - 4283 - B829 - 2F 464F 055E61 }.$$method0x600016f - 1 == null)
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext is null.");
            }
            if (owaContext.HttpContext == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext.HttpContext is null.");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = null;
            state  = null;
            action = null;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.Type   = "IPM.Appointment";
            preFormActionResponse.Action = string.Empty;
            preFormActionResponse.State  = string.Empty;
            this.request     = owaContext.HttpContext.Request;
            this.userContext = owaContext.UserContext;
            InfobarMessage infobarMessage = null;
            StoreObjectId  storeObjectId  = null;
            string         changeKey      = null;
            string         action2        = owaContext.FormsRegistryContext.Action;
            string         text;

            if (string.Equals(action2, "New", StringComparison.Ordinal))
            {
                text = "new";
            }
            else
            {
                if (!Utilities.IsPostRequest(this.request))
                {
                    return(this.userContext.LastClientViewState.ToPreFormActionResponse());
                }
                text = Utilities.GetFormParameter(this.request, "hidcmdpst");
                string formParameter = Utilities.GetFormParameter(this.request, "hidid", false);
                changeKey = Utilities.GetFormParameter(this.request, "hidchk", false);
                if (!string.IsNullOrEmpty(formParameter))
                {
                    storeObjectId = Utilities.CreateStoreObjectId(this.userContext.MailboxSession, formParameter);
                }
            }
            StoreObjectId calendarFolderId = EditCalendarItemHelper.GetCalendarFolderId(this.request, this.userContext);
            bool          syncCalendarItem = true;

            if (text.Equals("attch", StringComparison.Ordinal))
            {
                syncCalendarItem = false;
            }
            bool flag = true;

            try
            {
                EditCalendarItemHelper.CalendarItemUpdateFlags storeUpdateFlags = EditCalendarItemHelper.CalendarItemUpdateFlags.None;
                if (!text.Equals("cls", StringComparison.Ordinal))
                {
                    storeUpdateFlags = EditCalendarItemHelper.GetCalendarItem(this.userContext, storeObjectId, calendarFolderId, changeKey, syncCalendarItem, out this.calendarItemBase);
                }
                switch (this.DoAction(text, storeUpdateFlags, ref preFormActionResponse, out infobarMessage))
                {
                case EditCalendarItemPreFormAction.RedirectTo.None:
                    throw new OwaInvalidRequestException("Unhandled redirection.");

                case EditCalendarItemPreFormAction.RedirectTo.AddressBook:
                    preFormActionResponse = EditMessageHelper.RedirectToPeoplePicker(owaContext, this.calendarItemBase, AddressBook.Mode.EditCalendar);
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.ADPage:
                    preFormActionResponse = EditMessageHelper.RedirectToRecipient(owaContext, this.calendarItemBase, AddressBook.Mode.EditCalendar);
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.AttachmentManager:
                    if (this.calendarItemBase.Id == null)
                    {
                        CalendarUtilities.SaveCalendarItem(this.calendarItemBase, this.userContext, out infobarMessage);
                    }
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(this.userContext, null))
                    {
                        CalendarItemBaseData userContextData = EditCalendarItemHelper.GetUserContextData(this.userContext);
                        userContextData.CopyTo(calendarItemBase);
                        string text2;
                        EditCalendarItemHelper.UpdateCalendarItemValues(calendarItemBase, this.userContext, this.request, out text2);
                        EditCalendarItemHelper.CreateUserContextData(this.userContext, calendarItemBase);
                        if (this.calendarItemBase.Id != null)
                        {
                            CalendarItemBaseData userContextData2 = EditCalendarItemHelper.GetUserContextData(this.userContext);
                            userContextData2.Id        = this.calendarItemBase.Id.ObjectId;
                            userContextData2.ChangeKey = this.calendarItemBase.Id.ChangeKeyAsBase64String();
                        }
                    }
                    if (infobarMessage == null)
                    {
                        this.RedirectToAttachmentManager(owaContext, preFormActionResponse);
                    }
                    else
                    {
                        owaContext.PreFormActionData = this.calendarItemBase;
                        flag = false;
                        this.RedirectToEdit(owaContext, infobarMessage, preFormActionResponse);
                    }
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.CalendarDailyView:
                    EditCalendarItemHelper.ClearUserContextData(this.userContext);
                    preFormActionResponse = this.userContext.LastClientViewState.ToPreFormActionResponse();
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.EditCalendarItem:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = this.calendarItemBase;
                    flag = false;
                    this.RedirectToEdit(owaContext, infobarMessage, preFormActionResponse);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.EditRecurrence:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = CalendarItemBaseData.Create(this.calendarItemBase);
                    preFormActionResponse.Action = "EditRecurrence";
                    if (this.calendarItemBase.IsDirty)
                    {
                        preFormActionResponse.AddParameter("cd", "1");
                    }
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.SchedulingTab:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = this.calendarItemBase;
                    this.RedirectToSchedulingTab(owaContext, infobarMessage, preFormActionResponse);
                    flag = false;
                    break;

                default:
                    throw new OwaInvalidRequestException("Unhandled redirection enum value in EditCalendarItemPreFormAction.");
                }
            }
            catch
            {
                flag = true;
                EditCalendarItemHelper.ClearUserContextData(this.userContext);
                throw;
            }
            finally
            {
                if (flag && this.calendarItemBase != null)
                {
                    this.calendarItemBase.Dispose();
                    this.calendarItemBase = null;
                }
            }
            return(preFormActionResponse);
        }
        // Token: 0x060001E9 RID: 489 RVA: 0x000128F8 File Offset: 0x00010AF8
        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.NotSet;
            type             = string.Empty;
            action           = string.Empty;
            state            = string.Empty;
            this.userContext = owaContext.UserContext;
            this.httpRequest = owaContext.HttpContext.Request;
            if (!Utilities.IsPostRequest(this.httpRequest))
            {
                return(this.userContext.LastClientViewState.ToPreFormActionResponse());
            }
            this.folderManagementHelper = new FolderManagementHelper(owaContext);
            this.module = RequestParser.GetNavigationModuleFromQueryString(this.httpRequest, NavigationModule.Mail, true);
            if ((this.module == NavigationModule.Calendar && !this.userContext.IsFeatureEnabled(Feature.Calendar)) || (this.module == NavigationModule.Contacts && !this.userContext.IsFeatureEnabled(Feature.Contacts)))
            {
                throw new OwaSegmentationException("The " + this.module.ToString() + " feature is disabled");
            }
            this.folderId = RequestParser.GetFolderIdFromQueryString(this.httpRequest, true);
            string action2;

            if ((action2 = owaContext.FormsRegistryContext.Action) != null)
            {
                PreFormActionResponse preFormActionResponse;
                if (!(action2 == "Create"))
                {
                    if (!(action2 == "Rename"))
                    {
                        if (!(action2 == "Move"))
                        {
                            if (!(action2 == "Delete"))
                            {
                                goto IL_152;
                            }
                            preFormActionResponse = this.ExecuteDeleteAction();
                        }
                        else
                        {
                            preFormActionResponse = this.ExecuteMoveAction();
                        }
                    }
                    else
                    {
                        preFormActionResponse = this.ExecuteRenameAction();
                    }
                }
                else
                {
                    preFormActionResponse = this.ExecuteCreateAction();
                }
                if (owaContext[OwaContextProperty.InfobarMessage] != null)
                {
                    ((InfobarMessage)owaContext[OwaContextProperty.InfobarMessage]).IsActionResult = true;
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Dialog;
                preFormActionResponse.Type = "FolderManagement";
                PreFormActionResponse preFormActionResponse2 = preFormActionResponse;
                string name = "m";
                int    num  = (int)this.module;
                preFormActionResponse2.AddParameter(name, num.ToString());
                preFormActionResponse.AddParameter("fid", this.folderId.ToBase64String());
                return(preFormActionResponse);
            }
IL_152:
            throw new OwaInvalidRequestException("Invalid action for folder management preformaction");
        }
Example #29
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");
            }
            HttpContext httpContext = owaContext.HttpContext;
            UserContext userContext = owaContext.UserContext;
            HttpRequest request     = httpContext.Request;

            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            if (owaContext.FormsRegistryContext.Action == null)
            {
                throw new OwaInvalidRequestException("Action is missing");
            }
            string        formParameter = Utilities.GetFormParameter(request, "hidid", true);
            StoreObjectId storeObjectId = Utilities.CreateStoreObjectId(userContext.MailboxSession, formParameter);
            string        action2;

            if ((action2 = owaContext.FormsRegistryContext.Action) != null)
            {
                if (!(action2 == "Mail"))
                {
                    if (!(action2 == "MeetingRequest"))
                    {
                        if (action2 == "Delete")
                        {
                            goto IL_1E9;
                        }
                        if (!(action2 == "AddRcpt"))
                        {
                            goto IL_33E;
                        }
                        AddressBook.Mode mode = AddressBookHelper.TryReadAddressBookMode(request, AddressBook.Mode.None);
                        if (mode != AddressBook.Mode.EditMessage && mode != AddressBook.Mode.EditMeetingResponse && mode != AddressBook.Mode.EditCalendar)
                        {
                            throw new OwaInvalidRequestException("Not in edit mode");
                        }
                        string        queryStringParameter = Utilities.GetQueryStringParameter(request, "id", false);
                        StoreObjectId itemId = null;
                        if (!string.IsNullOrEmpty(queryStringParameter))
                        {
                            itemId = Utilities.CreateStoreObjectId(userContext.MailboxSession, queryStringParameter);
                        }
                        string            queryStringParameter2 = Utilities.GetQueryStringParameter(request, "chk", false);
                        RecipientItemType type2 = (RecipientItemType)RequestParser.TryGetIntValueFromQueryString(request, "rw", 1);
                        using (Item item = AddressBookHelper.GetItem(userContext, mode, itemId, queryStringParameter2))
                        {
                            Participant participant = Utilities.CreateParticipantFromQueryString(userContext, request);
                            if (participant != null)
                            {
                                AddressBookHelper.AddParticipantToItem(item, type2, participant);
                                CalendarItemBase calendarItemBase = item as CalendarItemBase;
                                if (calendarItemBase != null)
                                {
                                    EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                                }
                                else if (item is MessageItem)
                                {
                                    AddressBookHelper.SaveItem(item);
                                }
                            }
                            return(AddressBookHelper.RedirectToEdit(userContext, item, mode));
                        }
                        goto IL_33E;
                    }
                }
                else
                {
                    using (MessageItem messageItem = MessageItem.Create(userContext.MailboxSession, userContext.DraftsFolderId))
                    {
                        messageItem[ItemSchema.ConversationIndexTracking] = true;
                        AddressBookHelper.AddContactsToDraft(messageItem, RecipientItemType.To, userContext, new string[]
                        {
                            storeObjectId.ToBase64String()
                        });
                        preFormActionResponse.AddParameter("id", messageItem.Id.ObjectId.ToBase64String());
                        preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                        preFormActionResponse.Type   = "IPM.Note";
                        preFormActionResponse.Action = "Open";
                        preFormActionResponse.State  = "Draft";
                        return(preFormActionResponse);
                    }
                }
                using (CalendarItemBase calendarItemBase2 = EditCalendarItemHelper.CreateDraft(userContext, userContext.CalendarFolderId))
                {
                    calendarItemBase2.IsMeeting = true;
                    AddressBookHelper.AddContactsToDraft(calendarItemBase2, RecipientItemType.To, userContext, new string[]
                    {
                        storeObjectId.ToBase64String()
                    });
                    preFormActionResponse.Action             = "Open";
                    preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                    preFormActionResponse.Type = calendarItemBase2.ClassName;
                    EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase2);
                    return(preFormActionResponse);
                }
IL_1E9:
                string formParameter2 = Utilities.GetFormParameter(request, "hidcmdpst", true);
                if (formParameter2 == "d")
                {
                    Utilities.DeleteItems(userContext, DeleteItemFlags.SoftDelete, new StoreId[]
                    {
                        storeObjectId
                    });
                }
                else
                {
                    if (!(formParameter2 == "m"))
                    {
                        throw new OwaInvalidRequestException("Unknown delete command");
                    }
                    Utilities.DeleteItems(userContext, DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                    {
                        storeObjectId
                    });
                }
                userContext.ForceNewSearch = true;
                preFormActionResponse      = userContext.LastClientViewState.ToPreFormActionResponse();
                return(preFormActionResponse);
            }
IL_33E:
            throw new OwaInvalidRequestException("Invalid action for readcontact preformaction");
        }
 // Token: 0x060001C2 RID: 450 RVA: 0x00010BCA File Offset: 0x0000EDCA
 private static void RedirectToAttachmentManager(OwaContext owaContext, PreFormActionResponse response, MessageItem message)
 {
     response.ApplicationElement = ApplicationElement.Dialog;
     response.Type = "Attach";
     response.AddParameter("id", message.Id.ObjectId.ToBase64String());
 }