private static bool ResolveRecipientParametersFromLegacyDN(string legacyDN, StoreSession session, IRecipientSession recipientSession, out SecurityIdentifier securityIdentifier, out List <SecurityIdentifier> sidHistory, out bool isGroup, out string displayName) { securityIdentifier = null; sidHistory = null; isGroup = false; displayName = string.Empty; if (legacyDN == string.Empty) { securityIdentifier = AclHelper.everyoneSecurityIdentifier; return(true); } if (string.Compare(legacyDN, "Anonymous", StringComparison.OrdinalIgnoreCase) == 0) { securityIdentifier = AclHelper.anonymousSecurityIdentifier; displayName = "Anonymous"; return(true); } MiniRecipient[] array = recipientSession.FindMiniRecipient(null, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, MiniRecipientSchema.LegacyExchangeDN, legacyDN), null, 2, Array <PropertyDefinition> .Empty); if (array == null || array.Length == 0) { return(false); } if (array.Length > 1) { throw new NonUniqueLegacyExchangeDNException(ServerStrings.ErrorNonUniqueLegacyDN(legacyDN)); } SecurityIdentifier masterAccountSid = array[0].MasterAccountSid; if (masterAccountSid != null && !masterAccountSid.IsWellKnown(WellKnownSidType.SelfSid)) { securityIdentifier = masterAccountSid; } else { securityIdentifier = array[0].Sid; MultiValuedProperty <SecurityIdentifier> sidHistory2 = array[0].SidHistory; if (sidHistory2 != null && sidHistory2.Count != 0) { sidHistory = new List <SecurityIdentifier>(sidHistory2); } } if (securityIdentifier == null) { throw new CorruptDataException(ServerStrings.UserSidNotFound(legacyDN)); } isGroup = AclHelper.IsGroupRecipientType(array[0].RecipientType); if (!AclHelper.IsNTUserLegacyDN(legacyDN, session.InternalPreferedCulture, securityIdentifier, out displayName)) { displayName = array[0].DisplayName; } return(true); }