Exemple #1
0
        public IEnumerable <List <Group> > GetDistributionGroups(CancellationToken token)
        {
            // We will let Graph filter what it can, but functionality seems to be limited for now.
            // https://msdn.microsoft.com/en-us/library/azure/ad/graph/howto/azure-ad-graph-api-supported-queries-filters-and-paging-options

            IGraphServiceGroupsCollectionPage page = null;

            try
            {
                page = client.Groups.Request()
                       .Filter("securityEnabled eq false") // Non-security groups
                       .GetAsync(token).Result;
            }
            catch (Exception ex)
            {
                HandleException(ex, null, messageOnlyExceptions, "");
            }

            while (page != null)
            {
                yield return(page.ToList());

                if (page.NextPageRequest == null)
                {
                    break;
                }
                page = page.NextPageRequest.GetAsync(token).Result;
            }
        }
Exemple #2
0
        public IEnumerable <List <Group> > GetMailEnabledSecurityGroups(CancellationToken token)
        {
            // We will let Graph filter what it can, but functionality seems to be limited for now.
            // https://msdn.microsoft.com/en-us/library/azure/ad/graph/howto/azure-ad-graph-api-supported-queries-filters-and-paging-options

            // Get all security groups
            // mailEnabled is not available for filtering
            // See https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#group-entity for details
            IGraphServiceGroupsCollectionPage page = null;

            try
            {
                page = client.Groups.Request()
                       .Filter("securityEnabled eq true")
                       .GetAsync(token).Result;
            }
            catch (Exception ex)
            {
                HandleException(ex, null, messageOnlyExceptions, "");
            }

            while (page != null)
            {
                yield return(page.ToList());

                if (page.NextPageRequest == null)
                {
                    break;
                }
                page = page.NextPageRequest.GetAsync(token).Result;
            }
        }
Exemple #3
0
        public IEnumerable <List <Group> > GetGroups(CancellationToken token)
        {
            IGraphServiceGroupsCollectionPage page = null;

            try
            {
                page = client.Groups.Request().GetAsync(token).Result;
            }
            catch (Exception ex)
            {
                HandleException(ex, null, messageOnlyExceptions, "");
            }

            while (page != null)
            {
                yield return(page.ToList());

                if (page.NextPageRequest == null)
                {
                    break;
                }
                page = page.NextPageRequest.GetAsync(token).Result;
            }
        }