internal static bool IsMemberOf(IRuleEvaluationContext context, byte[] recipientEntryId, byte[] groupEntryId) { ProxyAddress legacyProxyAddress = RuleUtil.GetLegacyProxyAddress(context, recipientEntryId); if (legacyProxyAddress == null) { context.TraceDebug("IsMemberOf: unable to get legacy DN for recipient."); return(false); } ProxyAddress legacyProxyAddress2 = RuleUtil.GetLegacyProxyAddress(context, groupEntryId); if (legacyProxyAddress2 == null) { context.TraceDebug("IsMemberOf: unable to get address for group, this rule is in error."); throw new InvalidRuleException(ServerStrings.FolderRuleErrorInvalidGroup(BitConverter.ToString(groupEntryId))); } context.TraceDebug <string, string>("IsMemberOf: Recipient=\"{0}\" Group=\"{1}\"", legacyProxyAddress.AddressString, legacyProxyAddress2.AddressString); Result <ADRawEntry> result = context.RecipientCache.FindAndCacheRecipient(legacyProxyAddress); if (result.Data == null) { context.TraceDebug("Recipient doesn't exist in AD"); context.RecordError(ServerStrings.FolderRuleErrorGroupDoesNotResolve(legacyProxyAddress.ToString())); return(false); } bool result2; try { IsMemberOfResolver <string> isMemberOfResolver = context.IsMemberOfResolver; bool flag = isMemberOfResolver.IsMemberOf(context.RecipientCache.ADSession, result.Data.Id, legacyProxyAddress2.AddressString); context.TraceDebug <bool>("IsMemberOf: {0}", flag); result2 = flag; } catch (AddressBookTransientException exception) { context.RecordError(exception, ServerStrings.FolderRuleStageEvaluation); result2 = false; } return(result2); }