private ADObjectId ValidateUser(SecurityPrincipalIdParameter principalId)
        {
            if (principalId == null)
            {
                return(null);
            }
            IEnumerable <ADRecipient> objects = principalId.GetObjects <ADRecipient>(null, base.TenantGlobalCatalogSession);
            ADObjectId result;

            using (IEnumerator <ADRecipient> enumerator = objects.GetEnumerator())
            {
                if (!enumerator.MoveNext())
                {
                    base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorUserNotFound(principalId.ToString())), ErrorCategory.ObjectNotFound, null);
                }
                ADObjectId adobjectId = (ADObjectId)enumerator.Current.Identity;
                if (enumerator.MoveNext())
                {
                    base.WriteError(new ManagementObjectAmbiguousException(Strings.ErrorUserNotUnique(principalId.ToString())), ErrorCategory.InvalidData, null);
                }
                this.WriteWarning(Strings.AccountPrivilegeWarning);
                result = adobjectId;
            }
            return(result);
        }
Exemple #2
0
 internal ADRecipient GetRecipient(SecurityPrincipalIdParameter securityPrincipalIdParameter, Task.ErrorLoggerDelegate writeError)
 {
     return((ADRecipient)base.GetDataObject <ADRecipient>(securityPrincipalIdParameter, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorRecipientNotFound(securityPrincipalIdParameter.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(securityPrincipalIdParameter.ToString()))));
 }