protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Utilities.GetQueryStringParameter(base.Request, "atttyp", false) != null && Utilities.GetQueryStringParameter(base.Request, "atttyp", false) == "embdd") { this.isEmbeddedItem = true; } string text = null; string text2 = null; this.itemId = QueryStringUtilities.CreateItemStoreObjectId(base.UserContext.MailboxSession, base.Request, false); if (this.itemId == null) { if (Utilities.IsPostRequest(base.Request)) { text = Utilities.GetFormParameter(base.Request, "hidid", false); text2 = Utilities.GetFormParameter(base.Request, "hidchk", false); } if (!string.IsNullOrEmpty(text2)) { this.itemStoreId = Utilities.CreateItemId(base.UserContext.MailboxSession, text, text2); } if (!string.IsNullOrEmpty(text)) { this.itemId = Utilities.CreateStoreObjectId(base.UserContext.MailboxSession, text); } } }
private bool LoadMessage() { StoreObjectId storeObjectId = QueryStringUtilities.CreateItemStoreObjectId(base.UserContext.MailboxSession, base.Request, false); if (storeObjectId != null) { base.Item = (this.message = Utilities.GetItem <MessageItem>(base.UserContext, storeObjectId, new PropertyDefinition[0])); return(false); } string formParameter = Utilities.GetFormParameter(base.Request, "hidid", false); string formParameter2 = Utilities.GetFormParameter(base.Request, "hidchk", false); if (Utilities.IsPostRequest(base.Request) && !string.IsNullOrEmpty(formParameter) && !string.IsNullOrEmpty(formParameter2)) { storeObjectId = Utilities.CreateStoreObjectId(base.UserContext.MailboxSession, formParameter); base.Item = (this.message = Utilities.GetItem <MessageItem>(base.UserContext, storeObjectId, formParameter2, new PropertyDefinition[0])); } if (this.message == null) { string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "email", false); if (!string.IsNullOrEmpty(queryStringParameter)) { StoreObjectId storeObjectId2 = null; if (MailToParser.TryParseMailTo(queryStringParameter, base.UserContext, out storeObjectId2)) { storeObjectId = storeObjectId2; base.Item = (this.message = Utilities.GetItem <MessageItem>(base.UserContext, storeObjectId, new PropertyDefinition[0])); } } } return(true); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "ctx"); int num; if (!int.TryParse(queryStringParameter, out num)) { throw new OwaInvalidRequestException("Context parameter is having invalid format"); } if (num < 0 || num > 4) { throw new OwaInvalidRequestException("Invalid context value in the querystring parameter"); } this.viewMode = (AddressBook.Mode)num; if (this.viewMode == AddressBook.Mode.None) { this.viewMode = AddressBook.Mode.Lookup; } if (base.IsPostFromMyself()) { this.action = Utilities.GetFormParameter(base.Request, "hidcmdpst", false); this.searchString = Utilities.GetFormParameter(base.Request, "hidss", false); this.pageNumber = RequestParser.TryGetIntValueFromForm(base.Request, "hidpg", 1); this.sortColumn = (ColumnId)RequestParser.TryGetIntValueFromForm(base.Request, "hidcid", 11); this.sortOrder = (SortOrder)RequestParser.TryGetIntValueFromForm(base.Request, "hidso", 1); this.addressBookToSearch = Utilities.GetFormParameter(base.Request, "hidAB", false); if (string.IsNullOrEmpty(this.addressBookToSearch)) { throw new OwaInvalidRequestException("addressbookGuid can't be null"); } this.recipientWell = (RecipientItemType)RequestParser.TryGetIntValueFromForm(base.Request, "hidrw", 1); } else { this.searchString = Utilities.GetQueryStringParameter(base.Request, "sch", false); if (!string.IsNullOrEmpty(this.searchString)) { Utilities.VerifySearchCanaryInGetRequest(base.Request); } this.pageNumber = RequestParser.TryGetIntValueFromQueryString(base.Request, "pg", 1); this.sortColumn = (ColumnId)RequestParser.TryGetIntValueFromQueryString(base.Request, "cid", 11); this.sortOrder = (SortOrder)RequestParser.TryGetIntValueFromQueryString(base.Request, "so", 1); this.addressBookToSearch = Utilities.GetQueryStringParameter(base.Request, "ab", false); this.recipientWell = (RecipientItemType)RequestParser.TryGetIntValueFromQueryString(base.Request, "rw", 1); } this.GetSearchLocation(); if (AddressBook.IsEditingMode(this.viewMode)) { if (!base.IsPostFromMyself()) { bool required = this.viewMode != AddressBook.Mode.EditCalendar; StoreObjectId itemId = QueryStringUtilities.CreateItemStoreObjectId(base.UserContext.MailboxSession, base.Request, required); base.Item = AddressBookHelper.GetItem(base.UserContext, this.viewMode, itemId, null); } else { StoreObjectId itemId2 = null; string formParameter = Utilities.GetFormParameter(base.Request, "hidid", true); if (!string.IsNullOrEmpty(formParameter)) { itemId2 = Utilities.CreateStoreObjectId(base.UserContext.MailboxSession, formParameter); } string formParameter2 = Utilities.GetFormParameter(base.Request, "hidchk", true); base.Item = AddressBookHelper.GetItem(base.UserContext, this.viewMode, itemId2, formParameter2); string a; if ((a = this.action) != null) { if (!(a == "addrcp")) { if (a == "rmrcp") { int intValueFromForm = RequestParser.GetIntValueFromForm(base.Request, "hidri"); if (this.viewMode == AddressBook.Mode.EditMessage || this.viewMode == AddressBook.Mode.EditMeetingResponse) { if (intValueFromForm >= 0 && intValueFromForm < this.Message.Recipients.Count) { this.Message.Recipients.RemoveAt(intValueFromForm); AddressBookHelper.SaveItem(base.Item); } } else if (this.viewMode == AddressBook.Mode.EditCalendar) { CalendarUtilities.RemoveAttendeeAt(this.CalendarItemBase, intValueFromForm); EditCalendarItemHelper.CreateUserContextData(base.UserContext, this.CalendarItemBase); } } } else { int num2 = RequestParser.TryGetIntValueFromQueryString(base.Request, "rt", 1); if (num2 == 1) { this.type = RecipientItemType.To; } else if (num2 == 2) { this.type = RecipientItemType.Cc; } else if (num2 == 3) { this.type = RecipientItemType.Bcc; } string text = base.Request.Form["chkRcpt"]; if (!string.IsNullOrEmpty(text)) { this.ids = text.Split(new char[] { ',' }); if (this.searchLocation == AddressBook.SearchLocation.AddressBook) { AddressBookHelper.AddRecipientsToDraft(this.ids, base.Item, this.type, base.UserContext); } else { AddressBookHelper.AddContactsToDraft(base.Item, this.type, base.UserContext, this.ids); } } } } } } if (!string.IsNullOrEmpty(this.searchString)) { this.searchString = this.searchString.Trim(); if (this.searchString.Length > Globals.MaxSearchStringLength) { throw new OwaInvalidRequestException("Search string length is more than 256 characters"); } } if (this.pageNumber == 0) { this.pageNumber = 1; } this.firstItemOnPage = (this.pageNumber - 1) * base.UserContext.UserOptions.BasicViewRowCount + 1; this.lastItemOnPage = this.firstItemOnPage + base.UserContext.UserOptions.BasicViewRowCount - 1; this.CreateListView(); if (AddressBook.IsEditingMode(this.viewMode) || !string.IsNullOrEmpty(this.searchString)) { base.UserContext.LastClientViewState = new AddressBookSearchViewState(base.UserContext.LastClientViewState, this.viewMode, this.addressBookToSearch, this.searchString, this.pageNumber, (base.Item == null || base.Item.Id == null) ? null : base.Item.Id.ObjectId, (base.Item == null || base.Item.Id == null) ? null : base.Item.Id.ChangeKeyAsBase64String(), this.recipientWell, this.sortColumn, this.sortOrder); return; } base.UserContext.LastClientViewState = new AddressBookViewState(base.UserContext.LastClientViewState, this.viewMode, this.pageNumber, (base.Item == null || base.Item.Id == null) ? null : base.Item.Id.ObjectId, (base.Item == null || base.Item.Id == null) ? null : base.Item.Id.ChangeKeyAsBase64String(), this.recipientWell, this.sortColumn, this.sortOrder); }