Disco.Services.Devices.ManagedGroups.DeviceBatchDevicesManagedGroup.TryGetManagedGroup C# (CSharp) Method

TryGetManagedGroup() public static method

public static TryGetManagedGroup ( DeviceBatch DeviceBatch, DeviceBatchDevicesManagedGroup &ManagedGroup ) : bool
DeviceBatch Disco.Models.Repository.DeviceBatch
ManagedGroup DeviceBatchDevicesManagedGroup
return bool
        public static bool TryGetManagedGroup(DeviceBatch DeviceBatch, out DeviceBatchDevicesManagedGroup ManagedGroup)
        {
            ADManagedGroup managedGroup;
            string key = GetKey(DeviceBatch);

            if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup))
            {
                ManagedGroup = (DeviceBatchDevicesManagedGroup)managedGroup;
                return true;
            }
            else
            {
                ManagedGroup = null;
                return false;
            }
        }