private void RenderAddressBookSearchOptions() { string base64Guid = this.userContext.GlobalAddressListInfo.ToAddressBookBase().Base64Guid; string text = "Ad" + ';' + base64Guid; string b = null; if (OptionsBar.SearchModule.Contacts != this.searchModule) { if (this.IsFlagSet(OptionsBar.RenderingFlags.ShowSearchContext) && this.addressBookSearchViewState != null) { b = this.addressBookSearchViewState.SearchLocation; } else { b = text; } } this.RenderAddressBookSearchOption(text, text == b, LocalizedStrings.GetNonEncoded(1139489555), false); if (this.userContext.IsFeatureEnabled(Feature.AddressLists)) { foreach (AddressBookBase addressBookBase in DirectoryAssistance.GetAllAddressBooks(this.userContext)) { if (addressBookBase.Base64Guid != base64Guid) { string text2 = "Ad" + ';' + addressBookBase.Base64Guid; this.RenderAddressBookSearchOption(text2, text2 == b, ". " + addressBookBase.DisplayName, false); } } } }
// Token: 0x06001DFA RID: 7674 RVA: 0x000ADA28 File Offset: 0x000ABC28 private void LoadPagedSearch(int startRange, int itemCount, PropertyDefinition[] properties, bool retry) { int num = startRange; if (!string.IsNullOrEmpty(this.cookie)) { num = startRange - (this.cookieIndex + 1); } int itemsToSkip = num; object[][] array; int num2; if (DirectoryAssistance.IsEmptyAddressList(this.userContext)) { array = new object[0][]; num2 = 0; } else { array = AddressBookBase.PagedSearch(DirectoryAssistance.IsVirtualAddressList(this.userContext) ? this.userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN : null, DirectoryAssistance.IsVirtualAddressList(this.userContext) ? null : this.addressBookBase, this.userContext.ExchangePrincipal.MailboxInfo.OrganizationId, AddressBookBase.RecipientCategory.All, this.searchString, itemsToSkip, ref this.cookie, itemCount, out num2, ref this.lcid, ref this.preferredDC, properties); } if (array.Length > 0) { base.StartRange = startRange; base.EndRange = base.StartRange + (array.Length - 1); this.cookieIndex = base.EndRange; base.Items = array; return; } if (this.cookie != null && this.cookie.Length != 0 && retry) { this.cookieIndex = 0; this.LoadPagedSearch(0, itemCount, properties, false); return; } if (num2 != 0 && retry) { if (this.cookieIndex > 0) { num2 += this.cookieIndex + 1; } int num3 = num2 - 1; startRange = num3 - (itemCount - 1); if (startRange < 0) { startRange = 0; } this.cookie = null; this.cookieIndex = 0; this.lcid = Culture.GetUserCulture().LCID; this.LoadPagedSearch(startRange, itemCount, properties, false); return; } base.StartRange = int.MinValue; base.EndRange = int.MinValue; this.cookie = null; this.cookieIndex = 0; base.Items = array; }
// 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 void BindToAddressBook() { if (this.addressBookBase == null) { ADObjectId adobjectId = (ADObjectId)this.ListViewState.SourceContainerId; this.addressBookBase = DirectoryAssistance.FindAddressBook(adobjectId.ObjectGuid, base.UserContext); } }
public static SecondaryNavigationDirectoryList CreateCondensedDirectoryList(UserContext userContext, bool isRoomPicker) { SecondaryNavigationDirectoryList secondaryNavigationDirectoryList = new SecondaryNavigationDirectoryList(userContext); secondaryNavigationDirectoryList.AddEntry(userContext.GlobalAddressListInfo.DisplayName, userContext.GlobalAddressListInfo.ToBase64String(), !isRoomPicker, false); if (DirectoryAssistance.IsRoomsAddressListAvailable(userContext) && userContext.AllRoomsAddressBookInfo != null && !userContext.AllRoomsAddressBookInfo.IsEmpty) { secondaryNavigationDirectoryList.AddEntry(userContext.AllRoomsAddressBookInfo.DisplayName, userContext.AllRoomsAddressBookInfo.ToBase64String(), isRoomPicker, true); } return(secondaryNavigationDirectoryList); }
public override void LoadData(int startRange, int endRange) { ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "ADDataSource.LoadData(Start)"); int lcid = Culture.GetUserCulture().LCID; string preferredDC = this.userContext.PreferredDC; ExTraceGlobals.MailCallTracer.TraceDebug <string>((long)this.GetHashCode(), "AddressBookDataSource.LoadData: preferred DC in user context = '{0}'", preferredDC); if (startRange < 1) { throw new ArgumentOutOfRangeException("startRange", "startRange must be greater than 0"); } if (endRange < startRange) { throw new ArgumentOutOfRangeException("endRange", "endRange must be greater than or equal to startRange"); } PropertyDefinition[] properties = base.CreateProperyTable(); int num = endRange - startRange + 1; int pagesToSkip = startRange / num; string cookie = null; if (DirectoryAssistance.IsEmptyAddressList(this.userContext)) { base.Items = new object[0][]; } else if (!string.IsNullOrEmpty(this.searchString)) { base.Items = AddressBookBase.PagedSearch(DirectoryAssistance.IsVirtualAddressList(this.userContext) ? this.userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN : null, DirectoryAssistance.IsVirtualAddressList(this.userContext) ? null : this.addressBook, this.userContext.ExchangePrincipal.MailboxInfo.OrganizationId, this.recipientCategory, this.searchString, ref cookie, pagesToSkip, num, out this.itemsTouched, ref lcid, ref preferredDC, properties); } else { ExTraceGlobals.MailCallTracer.TraceDebug <OrganizationId>((long)this.GetHashCode(), "AddressBookDataSource.LoadData: browse: OrganizationId of address book = '{0}'", this.addressBook.OrganizationId); int num2; base.Items = this.addressBook.BrowseTo(ref cookie, this.userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN, ref lcid, ref preferredDC, startRange, num + 1, out num2, DirectoryAssistance.IsVirtualAddressList(this.userContext), properties); if (base.Items != null && base.Items.Length < num + 1) { cookie = null; } } this.userContext.PreferredDC = preferredDC; ExTraceGlobals.MailCallTracer.TraceDebug <string>((long)this.GetHashCode(), "AddressBookDataSource.LoadData: stamped preferred DC = '{0}' onto user context.", preferredDC); base.Cookie = cookie; base.StartRange = startRange; if (base.Items == null || base.Items.Length == 0) { base.EndRange = 0; return; } if (base.Items.Length < num) { base.EndRange = startRange + base.Items.Length - 1; return; } base.EndRange = endRange; }
// Token: 0x0600256D RID: 9581 RVA: 0x000D89FC File Offset: 0x000D6BFC internal override void RenderContents(TextWriter writer, UserContext userContext, RecipientWellType type, RecipientWellNode.RenderFlags flags, RenderRecipientWellNode wellNode) { if (writer == null) { throw new ArgumentNullException("writer"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } if (!this.HasRecipients(type)) { return; } RecipientWellNode.RenderFlags renderFlags = flags & ~RecipientWellNode.RenderFlags.RenderCommas; bool flag = true; string smtpAddress = null; string alias = null; int num = 0; MultiValuedProperty <string> addressList = this.GetAddressList(type); IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, userContext); foreach (string text in addressList) { ADObjectId adObjectId = null; ADRecipient adrecipient = recipientSession.FindByLegacyExchangeDN(text); bool flag2 = (flags & RecipientWellNode.RenderFlags.ReadOnly) != RecipientWellNode.RenderFlags.None; if (adrecipient != null) { adObjectId = adrecipient.Id; smtpAddress = adrecipient.PrimarySmtpAddress.ToString(); if (flag2) { alias = adrecipient.Alias; } if (adrecipient is IADDistributionList) { num |= 1; } if (DirectoryAssistance.IsADRecipientRoom(adrecipient)) { num |= 2; } } if (wellNode(writer, userContext, (adrecipient != null) ? adrecipient.DisplayName : text.ToString(), smtpAddress, (adrecipient != null) ? adrecipient.LegacyExchangeDN : text.ToString(), "EX", alias, (adrecipient != null) ? AddressOrigin.Directory : AddressOrigin.Unknown, num, null, EmailAddressIndex.None, adObjectId, renderFlags, null, null) && flag) { flag = false; if ((flags & RecipientWellNode.RenderFlags.RenderCommas) != RecipientWellNode.RenderFlags.None) { renderFlags |= RecipientWellNode.RenderFlags.RenderCommas; } } } }
private static void AddADRecipients(ADRawEntry[] adRecipients, AnrManager.Options options, List <RecipientAddress> addresses) { if (adRecipients != null) { foreach (ADRawEntry adrawEntry in adRecipients) { RecipientType recipientType = (RecipientType)adrawEntry[ADRecipientSchema.RecipientType]; if (recipientType == RecipientType.UserMailbox || recipientType == RecipientType.MailUniversalDistributionGroup || recipientType == RecipientType.MailUniversalSecurityGroup || recipientType == RecipientType.MailNonUniversalGroup || recipientType == RecipientType.MailUser || recipientType == RecipientType.MailContact || recipientType == RecipientType.DynamicDistributionGroup || recipientType == RecipientType.PublicFolder) { bool flag = Utilities.IsADDistributionList((MultiValuedProperty <string>)adrawEntry[ADObjectSchema.ObjectClass]); string text = Utilities.NormalizePhoneNumber((string)adrawEntry[ADOrgPersonSchema.MobilePhone]); if (!flag || !Utilities.IsFlagSet((int)options.RecipientBlockType, 1)) { bool isRoom = DirectoryAssistance.IsADRecipientRoom((RecipientDisplayType?)adrawEntry[ADRecipientSchema.RecipientDisplayType]); RecipientAddress recipientAddress = null; if (!flag && options.IsDefaultRoutingType("MOBILE")) { if (!string.IsNullOrEmpty(text)) { recipientAddress = new RecipientAddress(); recipientAddress.RoutingType = "MOBILE"; recipientAddress.RoutingAddress = text; } else if (options.OnlyAllowDefaultRoutingType) { goto IL_1BD; } } if (recipientAddress == null) { recipientAddress = new RecipientAddress(); recipientAddress.Alias = (string)adrawEntry[ADRecipientSchema.Alias]; recipientAddress.RoutingAddress = (string)adrawEntry[ADRecipientSchema.LegacyExchangeDN]; recipientAddress.RoutingType = "EX"; recipientAddress.SmtpAddress = adrawEntry[ADRecipientSchema.PrimarySmtpAddress].ToString(); } recipientAddress.AddressOrigin = AddressOrigin.Directory; recipientAddress.ADObjectId = (ADObjectId)adrawEntry[ADObjectSchema.Id]; recipientAddress.IsRoom = isRoom; recipientAddress.DisplayName = (string)adrawEntry[ADRecipientSchema.DisplayName]; recipientAddress.IsDistributionList = flag; recipientAddress.RecipientType = recipientType; recipientAddress.SipUri = InstantMessageUtilities.GetSipUri((ProxyAddressCollection)adrawEntry[ADRecipientSchema.EmailAddresses]); recipientAddress.MobilePhoneNumber = text; addresses.Add(recipientAddress); } } IL_1BD :; } } }
public static SecondaryNavigationDirectoryList CreateExtendedDirectoryList(UserContext userContext) { SecondaryNavigationDirectoryList secondaryNavigationDirectoryList = new SecondaryNavigationDirectoryList(userContext); AddressBookBase[] allAddressBooks = DirectoryAssistance.GetAllAddressBooks(userContext); for (int i = 0; i < allAddressBooks.Length; i++) { if (!string.Equals(allAddressBooks[i].Base64Guid, userContext.GlobalAddressListInfo.ToBase64String(), StringComparison.Ordinal) && (userContext.AllRoomsAddressBookInfo == null || !string.Equals(allAddressBooks[i].Base64Guid, userContext.AllRoomsAddressBookInfo.ToBase64String(), StringComparison.Ordinal))) { secondaryNavigationDirectoryList.AddEntry(allAddressBooks[i].DisplayName, allAddressBooks[i].Base64Guid, false, false); } } return(secondaryNavigationDirectoryList); }
// Token: 0x060000C2 RID: 194 RVA: 0x000071B8 File Offset: 0x000053B8 private static string GetSmtpAddressAndADObjectInfo(Participant recipient, AdRecipientBatchQuery adRecipientBatchQuery, out ADObjectId adObjectId, out int recipientAddressFlags, out int readItemType) { string result = string.Empty; recipientAddressFlags = 0; readItemType = 1; adObjectId = null; if (recipient.Origin is DirectoryParticipantOrigin) { ADRecipient adRecipient = adRecipientBatchQuery.GetAdRecipient(recipient.EmailAddress); if (adRecipient != null) { adObjectId = adRecipient.Id; result = adRecipient.PrimarySmtpAddress.ToString(); if (adRecipient is IADDistributionList) { recipientAddressFlags |= 1; readItemType = 2; } else { readItemType = 1; } if (DirectoryAssistance.IsADRecipientRoom(adRecipient)) { recipientAddressFlags |= 2; } } } else if (recipient.Origin is StoreParticipantOrigin) { if (Utilities.IsMapiPDL(recipient.RoutingType)) { result = recipient.EmailAddress; recipientAddressFlags |= 1; readItemType = 4; } else { result = recipient.EmailAddress; readItemType = 3; } } else { result = recipient.EmailAddress; } return(result); }
private void GetSearchLocation() { if (string.IsNullOrEmpty(this.searchString) || string.IsNullOrEmpty(this.addressBookToSearch)) { this.addressBookBase = base.UserContext.GlobalAddressListInfo.ToAddressBookBase(); this.addressBookToSearch = "Ad" + ';' + this.addressBookBase.Base64Guid; this.addressBookInfo = new string[] { "Ad", this.addressBookBase.Base64Guid }; return; } bool flag = false; this.addressBookInfo = this.addressBookToSearch.Split(new char[] { ';' }); if (this.addressBookInfo.Length == 2) { if (string.CompareOrdinal(this.addressBookInfo[0], "Ad") == 0) { if (!string.IsNullOrEmpty(this.addressBookInfo[1])) { flag = true; this.addressBookBase = DirectoryAssistance.FindAddressBook(this.addressBookInfo[1], base.UserContext); } } else if (string.CompareOrdinal(this.addressBookInfo[0], "Con") == 0) { flag = true; if (string.CompareOrdinal(this.action, "s") == 0) { this.isNewSearch = false; } this.searchLocation = AddressBook.SearchLocation.Contacts; this.folder = Folder.Bind(base.UserContext.MailboxSession, base.UserContext.ContactsFolderId); } } if (!flag) { throw new OwaInvalidRequestException("Invalid search location for addressbook"); } }
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")); }
private static void AddContactProperties(UserContext userContext, Contact contact, ADRecipient adRecipient, Participant participant) { IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, userContext); contact.JobTitle = (string)adRecipient[ADOrgPersonSchema.Title]; contact.Company = (string)adRecipient[ADOrgPersonSchema.Company]; contact.Department = (string)adRecipient[ADOrgPersonSchema.Department]; contact.OfficeLocation = (string)adRecipient[ADOrgPersonSchema.Office]; if (adRecipient[ADOrgPersonSchema.Manager] != null) { ADRecipient adrecipient = recipientSession.Read((ADObjectId)adRecipient[ADOrgPersonSchema.Manager]); if (adrecipient != null && !string.IsNullOrEmpty(adrecipient.DisplayName)) { contact[ContactSchema.Manager] = adrecipient.DisplayName; } } contact[ContactSchema.AssistantName] = (string)adRecipient[ADRecipientSchema.AssistantName]; contact.DisplayName = (string)adRecipient[ADRecipientSchema.DisplayName]; contact[ContactSchema.GivenName] = (string)adRecipient[ADOrgPersonSchema.FirstName]; contact[ContactSchema.Surname] = (string)adRecipient[ADOrgPersonSchema.LastName]; contact[ContactSchema.YomiFirstName] = (string)adRecipient[ADRecipientSchema.PhoneticFirstName]; contact[ContactSchema.YomiLastName] = (string)adRecipient[ADRecipientSchema.PhoneticLastName]; contact[ContactSchema.YomiCompany] = (string)adRecipient[ADRecipientSchema.PhoneticCompany]; contact[ContactSchema.FileAsId] = ContactUtilities.GetDefaultFileAs(); contact.EmailAddresses[EmailAddressIndex.Email1] = participant; contact[ContactSchema.PrimaryTelephoneNumber] = (string)adRecipient[ADOrgPersonSchema.Phone]; contact[ContactSchema.BusinessPhoneNumber] = (string)adRecipient[ADOrgPersonSchema.Phone]; contact[ContactSchema.HomePhone] = (string)adRecipient[ADOrgPersonSchema.HomePhone]; contact[ContactSchema.HomePhone2] = DirectoryAssistance.GetFirstResource((MultiValuedProperty <string>)adRecipient[ADOrgPersonSchema.OtherHomePhone]); contact[ContactSchema.WorkFax] = (string)adRecipient[ADOrgPersonSchema.Fax]; contact[ContactSchema.OtherFax] = DirectoryAssistance.GetFirstResource((MultiValuedProperty <string>)adRecipient[ADOrgPersonSchema.OtherFax]); contact[ContactSchema.Pager] = (string)adRecipient[ADOrgPersonSchema.Pager]; contact[ContactSchema.MobilePhone] = (string)adRecipient[ADOrgPersonSchema.MobilePhone]; contact[ContactSchema.WorkAddressStreet] = (string)adRecipient[ADOrgPersonSchema.StreetAddress]; contact[ContactSchema.WorkAddressState] = (string)adRecipient[ADOrgPersonSchema.StateOrProvince]; contact[ContactSchema.WorkAddressPostalCode] = (string)adRecipient[ADOrgPersonSchema.PostalCode]; contact[ContactSchema.WorkAddressCity] = (string)adRecipient[ADOrgPersonSchema.City]; contact[ContactSchema.WorkAddressCountry] = (string)adRecipient[ADOrgPersonSchema.Co]; }
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); }
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); }
// Token: 0x06002F23 RID: 12067 RVA: 0x0010FD4C File Offset: 0x0010DF4C private RecipientWellEventHandler.ADRecipientProperties GetADRecipientProperties(ADObjectId adObjectId, string routingAddress, string routingType) { if (string.IsNullOrEmpty(routingAddress)) { throw new ArgumentNullException("routingAddress"); } if (string.IsNullOrEmpty(routingType)) { throw new ArgumentNullException("routingType"); } IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, base.UserContext); ADRecipient adrecipient = null; RecipientWellEventHandler.ADRecipientProperties result = default(RecipientWellEventHandler.ADRecipientProperties); if (string.Equals(routingType, "EX", StringComparison.Ordinal)) { try { CustomProxyAddress proxyAddress = new CustomProxyAddress((CustomProxyAddressPrefix)ProxyAddressPrefix.LegacyDN, routingAddress, true); adrecipient = recipientSession.FindByProxyAddress(proxyAddress); goto IL_FB; } catch (NonUniqueRecipientException ex) { ExTraceGlobals.CoreTracer.TraceDebug <string>((long)this.GetHashCode(), "GetADRecipientProperties: NonUniqueRecipientException was thrown by FindByProxyAddress: {0}", ex.Message); throw new OwaEventHandlerException("Unable to retrieve properties.", LocalizedStrings.GetNonEncoded(-1953304495)); } } if (string.Equals(routingType, "SMTP", StringComparison.Ordinal)) { try { SmtpProxyAddress proxyAddress2 = new SmtpProxyAddress(routingAddress, true); adrecipient = recipientSession.FindByProxyAddress(proxyAddress2); } catch (NonUniqueRecipientException ex2) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "GetADRecipientProperties: NonUniqueRecipientException was thrown by FindByProxyAddress: {0}", ex2.Message); throw new OwaEventHandlerException("Unable to retrieve properties.", LocalizedStrings.GetNonEncoded(-1953304495)); } } IL_FB: if (adrecipient == null && adObjectId != null) { adrecipient = recipientSession.Read(adObjectId); } if (adrecipient == null) { throw new OwaEventHandlerException("Unable to retrieve properties.", LocalizedStrings.GetNonEncoded(-1953304495)); } IADOrgPerson iadorgPerson = adrecipient as IADOrgPerson; if (iadorgPerson != null) { result.Office = iadorgPerson.Office; result.Phone = iadorgPerson.Phone; if (adrecipient.Id == null) { throw new OwaEventHandlerException("Unable to retrieve id for AD Recipient.", LocalizedStrings.GetNonEncoded(-1953304495)); } result.Id = DirectoryAssistance.ToHtmlString(adrecipient.Id); } return(result); }
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; } }
// Token: 0x06001DFB RID: 7675 RVA: 0x000ADBC0 File Offset: 0x000ABDC0 private void LoadBrowsePage(int startRange, int itemCount, bool seekToCondition, PropertyDefinition[] properties) { int num; if (startRange > 1 && startRange < 2147483647) { num = startRange - 1; itemCount++; } else { num = startRange; } object[][] array; int num2; if (DirectoryAssistance.IsEmptyAddressList(this.userContext)) { array = new object[0][]; num2 = 0; } else if (seekToCondition) { array = this.addressBookBase.BrowseTo(ref this.cookie, this.userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN, ref this.lcid, ref this.preferredDC, this.searchString, itemCount, out num2, DirectoryAssistance.IsVirtualAddressList(this.userContext), properties); } else { array = this.addressBookBase.BrowseTo(ref this.cookie, this.userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN, ref this.lcid, ref this.preferredDC, num, itemCount, out num2, DirectoryAssistance.IsVirtualAddressList(this.userContext), properties); if (startRange > 1 && startRange < 2147483647) { itemCount--; if (array.Length > 1) { num2++; this.offsetForData = 1; } else if (array.Length == 1) { int num3 = num % itemCount; if (num3 == 0) { num = startRange - itemCount; } else { num = num - num3 + 1; } array = this.addressBookBase.BrowseTo(ref this.cookie, this.userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN, ref this.lcid, ref this.preferredDC, num, itemCount, out num2, DirectoryAssistance.IsVirtualAddressList(this.userContext), properties); } } } int num4 = (array.Length <= itemCount) ? (array.Length - this.offsetForData) : itemCount; if (num4 == 0 && !DirectoryAssistance.IsEmptyAddressList(this.userContext)) { this.offsetForData = 0; array = this.addressBookBase.BrowseTo(ref this.cookie, this.userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN, ref this.lcid, ref this.preferredDC, 0, itemCount, out num2, DirectoryAssistance.IsVirtualAddressList(this.userContext), properties); startRange = num2 - (itemCount - 1); if (startRange < 1) { startRange = 1; } array = this.addressBookBase.BrowseTo(ref this.cookie, this.userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN, ref this.lcid, ref this.preferredDC, startRange, itemCount, out num2, DirectoryAssistance.IsVirtualAddressList(this.userContext), properties); num4 = ((array.Length < itemCount) ? array.Length : itemCount); } if (num4 > 0) { base.StartRange = Math.Max(0, num2 - 1); base.EndRange = base.StartRange + num4 - 1; } else { base.StartRange = int.MinValue; base.EndRange = int.MinValue; } base.Items = array; }
// Token: 0x06002432 RID: 9266 RVA: 0x000D1148 File Offset: 0x000CF348 protected void RenderSecondaryNavigation(TextWriter output, bool showContacts) { if (output == null) { throw new ArgumentNullException("output"); } output.Write("<div id=\"{0}\" class=\"secNvPaneCont\">", this.lastModuleName); switch (this.navigationModule) { case NavigationModule.Mail: NavigationHost.RenderMailSecondaryNavigation(output, base.UserContext); goto IL_229; case NavigationModule.Calendar: { PropertyDefinition[] propsToReturn = new PropertyDefinition[] { ViewStateProperties.CalendarViewType, ViewStateProperties.DailyViewDays }; using (CalendarFolder calendarFolder = CalendarFolder.Bind(base.UserContext.MailboxSession, DefaultFolderType.Calendar, propsToReturn)) { DailyView.RenderSecondaryNavigation(output, calendarFolder, base.UserContext); goto IL_229; } break; } case NavigationModule.Contacts: break; case NavigationModule.Tasks: TaskView.RenderSecondaryNavigation(output, base.UserContext); goto IL_229; case NavigationModule.Options: goto IL_21D; case NavigationModule.AddressBook: this.recipientBlockType = ((AddressBook)this).RecipientBlockType; if (base.UserContext.IsFeatureEnabled(Feature.GlobalAddressList)) { bool isRoomPicker = ((AddressBook)this).IsRoomPicker && DirectoryAssistance.IsRoomsAddressListAvailable(base.UserContext); output.Write("<div class=\"abNavPane\" style=\"height:"); output.Write(showContacts ? "30" : "100"); output.Write("%;top:0px;\"><div id=\"divMdNmAD\">"); output.Write(LocalizedStrings.GetHtmlEncoded(346766088)); output.Write("</div><div id=\"divSecNvAD\">"); DirectoryView.RenderSecondaryNavigation(output, base.UserContext, isRoomPicker); output.Write("</div></div>"); } if (showContacts) { output.Write("<div class=\"abNavPane\" style=\"height:"); output.Write(base.UserContext.IsFeatureEnabled(Feature.GlobalAddressList) ? "70" : "100"); output.Write("%;bottom:0px;\"><div id=\"divMdNmC\">"); output.Write(LocalizedStrings.GetHtmlEncoded(-1165546057)); output.Write("</div><div id=\"divSecNvC\""); bool isPicker = ((AddressBook)this).IsPicker; if (isPicker) { output.Write(" class=\"noFltrsCntRg\""); } output.Write(">"); ContactView.RenderSecondaryNavigation(output, base.UserContext, isPicker); output.Write("</div></div>"); goto IL_229; } goto IL_229; case NavigationModule.Documents: DocumentLibraryUtilities.RenderSecondaryNavigation(output, base.UserContext); goto IL_229; case NavigationModule.PublicFolders: NavigationHost.RenderPublicFolderSecondaryNavigation(output, base.UserContext); goto IL_229; default: goto IL_21D; } ContactView.RenderSecondaryNavigation(output, base.UserContext, false); goto IL_229; IL_21D: NavigationHost.RenderMailSecondaryNavigation(output, base.UserContext); IL_229: output.Write("</div>"); }
// Token: 0x06001DF4 RID: 7668 RVA: 0x000AD87E File Offset: 0x000ABA7E public string GetItemId() { return(DirectoryAssistance.ToHtmlString(new ADObjectId(null, this.GetItemProperty <Guid>(ADObjectSchema.Guid, Guid.Empty)))); }
public static void AddRecipientsToDraft(string[] ids, Item draft, RecipientItemType type, UserContext userContext) { if (draft == null) { throw new ArgumentNullException("draft"); } MessageItem messageItem = draft as MessageItem; CalendarItemBase calendarItemBase = draft as CalendarItemBase; if (messageItem == null && calendarItemBase == null) { throw new ArgumentException("The draft should be a MessageItem or a CalendarItemBase while it is now a " + draft.GetType().Name); } if (userContext == null) { throw new ArgumentNullException("usercontext"); } if (ids == null || ids.Length == 0) { throw new ArgumentException("ids is null or empty.", "ids"); } IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, userContext); SortBy sortBy = new SortBy(ADRecipientSchema.DisplayName, SortOrder.Descending); RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext); for (int i = 0; i < ids.Length; i++) { Guid guidFromBase64String = Utilities.GetGuidFromBase64String(ids[i]); QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, guidFromBase64String); ADRecipient[] array = recipientSession.Find(null, QueryScope.SubTree, filter, sortBy, 1); if (array != null && array.Length != 0) { Participant participant = new Participant(array[0]); if (participant != null) { AddressBookHelper.AddParticipantToItem(draft, type, participant); int recipientFlags = 0; if (draft is CalendarItem && DirectoryAssistance.IsADRecipientRoom(array[0])) { recipientFlags = 2; } if (recipientCache != null && userContext.UserOptions.AddRecipientsToAutoCompleteCache) { string participantProperty = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SmtpAddress, null); recipientCache.AddEntry(array[0].DisplayName, participantProperty, array[0].LegacyExchangeDN, string.Empty, "EX", AddressOrigin.Directory, recipientFlags, null, EmailAddressIndex.None); } } } } if (recipientCache != null && recipientCache.IsDirty) { recipientCache.Commit(true); } if (messageItem != null) { AddressBookHelper.SaveItem(draft); return; } if (calendarItemBase != null) { EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase); } }