internal static string GetUsernameFromADRawEntry(ADRawEntry rawEntry) { SmtpAddress smtpAddress = SmtpAddress.Empty; if (rawEntry[ADRecipientSchema.WindowsLiveID] != null) { smtpAddress = (SmtpAddress)rawEntry[ADRecipientSchema.WindowsLiveID]; if (smtpAddress.IsValidAddress) { return(ClientAccessRulesUtils.GetUsernameFromWindowsLiveId(smtpAddress)); } } return(ClientAccessRulesUtils.GetUsernameFromIdInformation(smtpAddress, (SecurityIdentifier)rawEntry[ADRecipientSchema.MasterAccountSid], (SecurityIdentifier)rawEntry[ADMailboxRecipientSchema.Sid], rawEntry.Id)); }
internal static string GetUsernameFromIdInformation(SmtpAddress liveId, SecurityIdentifier masterAccountSid, SecurityIdentifier sid, ADObjectId adObjectId) { if (liveId.IsValidAddress) { return(ClientAccessRulesUtils.GetUsernameFromWindowsLiveId(liveId)); } if (masterAccountSid != null) { return(SidToAccountMap.Singleton.Get(masterAccountSid)); } if (sid != null) { return(SidToAccountMap.Singleton.Get(sid)); } return(ClientAccessRulesUtils.GetUsernameFromADObjectId(adObjectId)); }