Esempio n. 1
0
        private static bool UserExistsInAD(string sid)
        {
            ADSessionSettings sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 103, "UserExistsInAD", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\Auditing\\AdminAuditExternalAccessDeterminer.cs");

            PropertyDefinition[] properties = new PropertyDefinition[]
            {
                ADMailboxRecipientSchema.Sid
            };
            ADRawEntry adrawEntry = tenantOrRootOrgRecipientSession.FindUserBySid(new SecurityIdentifier(sid), properties);

            return(adrawEntry != null);
        }