public static LicenseeIdentity[] ConvertToLicenseeIdentities(RmsClientManagerContext context, string[] identities) { ArgumentValidator.ThrowIfNull("context", context); RmsClientManagerUtils.ThrowOnNullOrEmptyArrayArgument("identities", identities); LicenseeIdentity[] array = new LicenseeIdentity[identities.Length]; for (int i = 0; i < identities.Length; i++) { if (!SmtpAddress.IsValidSmtpAddress(identities[i])) { throw new RightsManagementException(RightsManagementFailureCode.InvalidRecipient, ServerStrings.RecipientAddressInvalid(identities[i])); } ADRawEntry adrawEntry; try { adrawEntry = context.ResolveRecipient(identities[i]); } catch (ADTransientException innerException) { throw new ExchangeConfigurationException(ServerStrings.FailedToReadUserConfig(identities[i]), innerException); } catch (ADOperationException innerException2) { throw new RightsManagementException(RightsManagementFailureCode.ADUserNotFound, ServerStrings.FailedToReadUserConfig(identities[i]), innerException2); } IList <string> list = RmsClientManagerUtils.EmptyProxyList; string text = null; bool flag = false; if (adrawEntry != null) { ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)adrawEntry[ADRecipientSchema.EmailAddresses]; if (proxyAddressCollection != null && proxyAddressCollection.Count != 0) { list = new List <string>(proxyAddressCollection.Count); foreach (ProxyAddress proxyAddress in proxyAddressCollection) { list.Add(proxyAddress.ValueString); } } SmtpAddress smtpAddress = (SmtpAddress)adrawEntry[ADRecipientSchema.PrimarySmtpAddress]; if (smtpAddress.IsValidAddress) { text = smtpAddress.ToString(); } flag = RmsClientManagerUtils.TreatRecipientAsRMSSuperuser(context.OrgId, (RecipientTypeDetails)adrawEntry[ADRecipientSchema.RecipientTypeDetails]); } array[i] = new LicenseeIdentity(string.IsNullOrEmpty(text) ? identities[i] : text, list, flag); } return(array); }