public static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                ShowUsage();
                return(0);
            }

            string connectionUrl, token, groupName, clientId, redirectURL = "";

            try
            {
                CheckArguments(args, out connectionUrl, out token, out groupName, out clientId, out redirectURL);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);

                ShowUsage();
                return(-1);
            }

            try
            {
                Console.WriteLine("Executing Graph quick start samples...");
                Console.WriteLine("");

                //instantiate objects & execute
                Samples.EnumerateUsers objUsers = new Samples.EnumerateUsers(connectionUrl, token);

                //execute the client lib code. If you want to run the direct http calls then adjust (see below)
                objUsers.RunEnumerateUsersUsingClientLib();

                //instantiate objects & execute
                Samples.EnumerateMembersOfGroups objMembers = new Samples.EnumerateMembersOfGroups(connectionUrl, clientId, redirectURL);

                //execute the client lib code. If you want to run the direct http calls then adjust (see below)
                objMembers.RunEnumerateMembersOfGroupsUsingClientLib(groupName);

                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed to run the sample: " + ex.Message);
                return(1);
            }

            return(0);
        }
Example #2
0
        public static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                ShowUsage();
                return(0);
            }

            string connectionUrl, token, groupName, clientId, redirectURL = "";

            try
            {
                CheckArguments(args, out connectionUrl, out token, out groupName, out clientId, out redirectURL);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);

                ShowUsage();
                return(-1);
            }

            try
            {
                Console.WriteLine("Executing Graph quick start samples...");
                Console.WriteLine("");

                // Enumerate Users sample
                Samples.EnumerateUsers objUsers = new Samples.EnumerateUsers(connectionUrl, token);
                List <GraphUser>       users    = objUsers.RunEnumerateUsersUsingClientLib();

                // Enumber Group Memberships sample
                objUsers.RunEnumerateEnumerateGroupMembershipsUsingClientLib(users);

                // Enumerate Members of Groups sample
                Samples.EnumerateMembersOfGroups objMembers = new Samples.EnumerateMembersOfGroups(connectionUrl, clientId, redirectURL);
                objMembers.RunEnumerateMembersOfGroupsUsingClientLib(groupName);

                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed to run the sample: " + ex.Message);
                return(1);
            }

            return(0);
        }