// Token: 0x060027A9 RID: 10153 RVA: 0x000E0D40 File Offset: 0x000DEF40 protected override void OnInit(EventArgs e) { base.OnInit(e); this.contextMenu = new AddressBookContextMenu(base.UserContext, true, false); string text = base.OwaContext.FormsRegistryContext.Type; string action = base.OwaContext.FormsRegistryContext.Action; if (text != null) { object obj = DirectoryView.elementClassParser.Parse(text); if (obj != null && (DirectoryView.ElementClass)obj == DirectoryView.ElementClass.Rooms) { this.type |= DirectoryView.Type.Rooms; this.viewType = ViewType.RoomBrowser; } } if (!string.IsNullOrEmpty(action)) { if (string.Equals(action, "Pick", StringComparison.OrdinalIgnoreCase)) { this.viewType = ((DirectoryView.Type.Rooms == this.type) ? ViewType.RoomPicker : ViewType.DirectoryPicker); this.type |= DirectoryView.Type.Picker; } else if (string.Equals(action, "PickPaa", StringComparison.OrdinalIgnoreCase)) { this.type |= (DirectoryView.Type.Picker | DirectoryView.Type.PaaPicker); this.viewType = ViewType.DirectoryPicker; } else if (string.Equals(action, "PickMobile", StringComparison.OrdinalIgnoreCase)) { this.type |= DirectoryView.Type.Mobile; this.viewType = ViewType.DirectoryPicker; } } if (string.IsNullOrEmpty(base.SerializedContainerId)) { if (this.IsRoomView && this.IsPicker && DirectoryAssistance.IsRoomsAddressListAvailable(base.UserContext)) { this.addressBookBase = base.UserContext.AllRoomsAddressBookInfo.ToAddressBookBase(); return; } this.addressBookBase = base.UserContext.GlobalAddressListInfo.ToAddressBookBase(); return; } else { if (base.UserContext.GlobalAddressListInfo.Origin == GlobalAddressListInfo.GalOrigin.DefaultGlobalAddressList) { this.addressBookBase = DirectoryAssistance.FindAddressBook(base.SerializedContainerId, base.UserContext); return; } if (base.UserContext.GlobalAddressListInfo.Id.Equals(DirectoryAssistance.ParseADObjectId(base.SerializedContainerId))) { this.addressBookBase = base.UserContext.GlobalAddressListInfo.ToAddressBookBase(); return; } throw new OwaInvalidRequestException("Address Book Serialized Id is unsupported " + base.SerializedContainerId); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.recipientId = Utilities.GetQueryStringParameter(base.Request, "id"); this.hasOwner = !string.IsNullOrEmpty(Utilities.GetQueryStringParameter(base.Request, "oT", false)); if (this.hasOwner) { this.viewMode = AddressBookHelper.TryReadAddressBookMode(base.Request, AddressBook.Mode.None); if (AddressBook.IsEditingMode(this.viewMode)) { this.messageIdString = Utilities.GetQueryStringParameter(base.Request, "oId", false); this.changeKey = Utilities.GetQueryStringParameter(base.Request, "oCk", false); } } else { AddressBookViewState addressBookViewState = base.UserContext.LastClientViewState as AddressBookViewState; if (addressBookViewState != null) { this.viewMode = addressBookViewState.Mode; this.recipientWell = addressBookViewState.RecipientWell; if (addressBookViewState.ItemId != null) { this.messageIdString = addressBookViewState.ItemId.ToBase64String(); this.changeKey = addressBookViewState.ItemChangeKey; } } } this.session = Utilities.CreateADRecipientSession(Microsoft.Exchange.Clients.Owa.Core.Culture.GetUserCulture().LCID, true, ConsistencyMode.FullyConsistent, true, base.UserContext); ADObjectId adobjectId = DirectoryAssistance.ParseADObjectId(this.recipientId); if (adobjectId == null) { throw new OwaADObjectNotFoundException(); } this.adRecipient = this.session.Read(adobjectId); if (this.adRecipient == null) { throw new OwaADObjectNotFoundException(); } this.session = Utilities.CreateADRecipientSession(Microsoft.Exchange.Clients.Owa.Core.Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, base.UserContext); }
protected override void OnLoad(EventArgs e) { this.adObjectId = DirectoryAssistance.ParseADObjectId(Utilities.GetQueryStringParameter(base.Request, "id")); if (this.adObjectId == null) { throw new OwaInvalidRequestException(); } string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "email", false); this.adRecipientSession = Utilities.CreateADRecipientSession(Microsoft.Exchange.Clients.Owa.Core.Culture.GetUserCulture().LCID, true, ConsistencyMode.FullyConsistent, true, base.UserContext, false); this.adRecipient = Utilities.CreateADRecipientFromProxyAddress(this.adObjectId, queryStringParameter, this.adRecipientSession); if (this.adRecipient == null) { if (base.UserContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN != null) { this.adRecipientSession = Utilities.CreateADRecipientSession(Microsoft.Exchange.Clients.Owa.Core.Culture.GetUserCulture().LCID, true, ConsistencyMode.FullyConsistent, false, base.UserContext); this.adRecipient = Utilities.CreateADRecipientFromProxyAddress(this.adObjectId, queryStringParameter, this.adRecipientSession); if (this.adRecipient != null) { this.RecipientOutOfSearchScope = true; } } } else { this.adObjectId = (ADObjectId)this.adRecipient[ADObjectSchema.Id]; if (this.adRecipient.HiddenFromAddressListsEnabled) { this.RecipientOutOfSearchScope = true; } } if (this.adRecipient == null) { throw new OwaADObjectNotFoundException(); } this.adRecipientSession = Utilities.CreateADRecipientSession(Microsoft.Exchange.Clients.Owa.Core.Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, !this.RecipientOutOfSearchScope, base.UserContext); string action = base.OwaContext.FormsRegistryContext.Action; base.IsPreviewForm = (action != null && action.Equals("Preview")); }
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 void GetRecipientMenuProperties() { ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.GetRecipientMenuProperties"); AddressOrigin addressOrigin = (AddressOrigin)base.GetParameter("ao"); string text = null; if (base.IsParameterSet("em")) { text = (string)base.GetParameter("em"); } string routingType = (string)base.GetParameter("rt"); switch (addressOrigin) { case AddressOrigin.Store: { if (!base.IsParameterSet("id")) { throw new OwaInvalidRequestException("Missing contact id."); } StoreObjectId contactId = Utilities.CreateStoreObjectId((string)base.GetParameter("id")); RecipientWellEventHandler.ContactRecipientProperties contactRecipientProperties = this.GetContactRecipientProperties(contactId, base.UserContext); this.RenderContactProperties(contactRecipientProperties); return; } case AddressOrigin.Directory: { if (text == null) { throw new OwaInvalidRequestException("Missing email address."); } ADObjectId adObjectId = null; if (base.IsParameterSet("id")) { adObjectId = DirectoryAssistance.ParseADObjectId((string)base.GetParameter("id")); } RecipientWellEventHandler.ADRecipientProperties adrecipientProperties = this.GetADRecipientProperties(adObjectId, text, routingType); this.Writer.Write("<div>"); if (string.IsNullOrEmpty(adrecipientProperties.Office)) { this.Writer.Write("<span id=\"{0}\">{1}</span>", "AdOf", LocalizedStrings.GetHtmlEncoded(1766818386)); } else { this.Writer.Write("<span id=\"{0}\">{1}</span>", "AdOf", Utilities.HtmlEncode(adrecipientProperties.Office)); } if (string.IsNullOrEmpty(adrecipientProperties.Phone)) { this.Writer.Write("<span id=\"{0}\">{1}</span>", "AdPh", LocalizedStrings.GetHtmlEncoded(1766818386)); } else { this.Writer.Write("<span id=\"{0}\">{1}</span>", "AdPh", Utilities.HtmlEncode(adrecipientProperties.Phone)); } if (!string.IsNullOrEmpty(adrecipientProperties.Id)) { this.Writer.Write("<span id=\"{0}\">{1}</span>", "AdId", Utilities.HtmlEncode(adrecipientProperties.Id)); } this.Writer.Write("</div>"); return; } case AddressOrigin.OneOff: { RecipientWellEventHandler.ContactRecipientProperties contactRecipientProperties2 = this.GetContactRecipientProperties(text, base.UserContext); this.RenderContactProperties(contactRecipientProperties2); return; } default: return; } }
protected object ConvertToStrongType(Type paramType, string value) { if (string.IsNullOrEmpty(value)) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } try { if (paramType.IsEnum) { OwaEventEnumAttribute owaEventEnumAttribute = OwaEventRegistry.FindEnumInfo(paramType); int intValue = int.Parse(value, CultureInfo.InvariantCulture); object obj = owaEventEnumAttribute.FindValueInfo(intValue); if (obj == null) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse enum type. Type = {0}, Value = {1}", new object[] { paramType, value })); } return(obj); } if (paramType == typeof(int)) { return(int.Parse(value, CultureInfo.InvariantCulture)); } if (paramType == typeof(double)) { return(double.Parse(value, CultureInfo.InvariantCulture)); } if (paramType == typeof(ExDateTime)) { return(DateTimeUtilities.ParseIsoDate(value, this.EventHandler.OwaContext.SessionContext.TimeZone)); } if (paramType == typeof(bool)) { if (string.Equals(value, "0", StringComparison.Ordinal)) { return(false); } if (string.Equals(value, "1", StringComparison.Ordinal)) { return(true); } this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } else { if (paramType == typeof(StoreObjectId)) { UserContext userContext = this.EventHandler.OwaContext.UserContext; return(Utilities.CreateStoreObjectId(userContext.MailboxSession, value)); } if (paramType == typeof(ADObjectId)) { ADObjectId adobjectId = DirectoryAssistance.ParseADObjectId(value); if (adobjectId == null) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } return(adobjectId); } if (paramType == typeof(DocumentLibraryObjectId)) { UserContext userContext2 = this.EventHandler.OwaContext.UserContext; Uri uri; if (null == (uri = Utilities.TryParseUri(value))) { return(null); } ClassifyResult[] array = null; OwaWindowsIdentity owaWindowsIdentity = userContext2.LogonIdentity as OwaWindowsIdentity; if (owaWindowsIdentity != null && owaWindowsIdentity.WindowsPrincipal != null) { array = LinkClassifier.ClassifyLinks(owaWindowsIdentity.WindowsPrincipal, new Uri[] { uri }); } if (array == null || array.Length == 0) { return(null); } return(array[0].ObjectId); } else if (paramType == typeof(OwaStoreObjectId)) { UserContext userContext3 = this.EventHandler.OwaContext.UserContext; if (OwaStoreObjectId.IsDummyArchiveFolder(value)) { return(userContext3.GetArchiveRootFolderId()); } return(OwaStoreObjectId.CreateFromString(value)); } else { this.ThrowParserException("Internal error: unknown type"); } } } catch (FormatException) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } catch (OwaParsingErrorException) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } catch (OverflowException) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Type overflow. Type = {0}, Value = {1}", new object[] { paramType, value })); } return(null); }