コード例 #1
0
        private string GetOfficeDistinguishedNameByLocation(string location)
        {
            var preparedLocation  = PrepareLocation(location);
            var filter            = _filterBuildingService.BuildFilterForGettingOfficeByLocation(preparedLocation);
            var organizationUnits = _activeDirectoryService.FindEntities(_parentDistinguishedName, filter);

            var unit = organizationUnits.FirstOrDefault(o => o.GetPropertyValue(ActiveDirectoryConstants.EntityAttributes.Location) == preparedLocation);

            return(unit == null ? _parentDistinguishedName : unit.DistinguishedName);
        }