private static void RenderADPerson(UserContext userContext, string label, string name, TextWriter writer) { if (name.Length == 0) { return; } string text = null; IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, userContext); ADRecipient[] array = recipientSession.FindByANR(name, 2, null); if (array != null && array.Length == 1 && array[0].RecipientType == RecipientType.UserMailbox) { text = Utilities.GetBase64StringFromADObjectId(array[0].Id); } writer.Write("<tr><td class=\"lbl\">"); writer.Write(label); if (text != null) { writer.Write("</td><td class=\"txvl\"><a href=\"#\" id=\""); Utilities.HtmlEncode(text, writer); writer.Write("\" onclick=\"return onClkRcpt(this,1)\""); writer.Write(" class=\"map\">"); Utilities.HtmlEncode(name, writer); writer.Write("</a></td></tr>"); return; } writer.Write("</td><td class=\"txvl\">"); Utilities.HtmlEncode(name, writer); writer.Write("</td></tr>"); }
// Token: 0x06002AAA RID: 10922 RVA: 0x000EFC2C File Offset: 0x000EDE2C private void RenderADPerson(string label, string id, PropertyDefinition property) { string propertyValue = this.GetPropertyValue(property); if (propertyValue.Length == 0) { return; } string url = null; string text = null; IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, base.UserContext); ADRecipient[] array = recipientSession.FindByANR(propertyValue, 2, null); if (array != null && array.Length == 1 && array[0].RecipientType == RecipientType.UserMailbox) { text = Convert.ToBase64String(array[0].Id.ObjectGuid.ToByteArray()); } if (text != null) { url = "?ae=Item&t=AD.RecipientType.User&a=Open&id=" + Utilities.UrlEncode(text); } this.RenderSectionLabelValueAndUrl(label, id, propertyValue, url, true, false); }
internal static List <string> ValidateAddresses(IRecipientSession recipientSession, ADObjectId executingUserId, MultiValuedProperty <string> notificationEmailAddresses, out IList <LocalizedString> localizedWarnings) { if (recipientSession == null) { throw new ArgumentNullException("recipientSession"); } List <string> list = new List <string>(((notificationEmailAddresses != null) ? notificationEmailAddresses.Count : 0) + 1); localizedWarnings = new List <LocalizedString>(list.Count); if (executingUserId != null) { ADRecipient adrecipient = recipientSession.Read(executingUserId); if (adrecipient == null || !MobileDeviceTaskHelper.IsUserMailboxEnabled(adrecipient)) { localizedWarnings.Add(Strings.LogonUserIsNotAValidADRecipient(executingUserId.ToString())); } else { list.Add(adrecipient.PrimarySmtpAddress.ToString()); } } if (notificationEmailAddresses != null) { foreach (string text in notificationEmailAddresses) { if (!SmtpAddress.IsValidSmtpAddress(text)) { ADRecipient[] array = recipientSession.FindByANR(text, 2, null); if (array == null || array.Length != 1 || !MobileDeviceTaskHelper.IsUserMailboxEnabled(array[0])) { localizedWarnings.Add(Strings.InvalidSmtpAddressOrAlias(text)); } else { list.Add(array[0].PrimarySmtpAddress.ToString()); } } else { IRecipientSession recipientSession2 = recipientSession; if (GlobalSettings.IsMultiTenancyEnabled) { try { ADSessionSettings sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(SmtpAddress.Parse(text).Domain); recipientSession2 = DirectorySessionFactory.Default.CreateTenantRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 240, "ValidateAddresses", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\AirSync\\MobileDeviceTaskHelper.cs"); } catch (CannotResolveTenantNameException) { localizedWarnings.Add(Strings.InvalidSmtpAddressOrAlias(text)); recipientSession2 = null; } } if (recipientSession2 != null) { ADRecipient adrecipient2 = recipientSession2.FindByProxyAddress(ProxyAddress.Parse(text)); if (adrecipient2 == null) { localizedWarnings.Add(Strings.InvalidSmtpAddressOrAlias(text)); } else { list.Add(adrecipient2.PrimarySmtpAddress.ToString()); } } } } } return(list); }