Пример #1
0
        static void Main(string[] args)
        {
            init   = Console.ForegroundColor;
            client = new B2CGraphClient(clientId, clientSecret, tenant);

            CreateUser();
        }
Пример #2
0
        static void Main(string[] args)
        {
            init = Console.ForegroundColor;
            client = new B2CGraphClient(clientId, clientSecret, tenant);

            if (args.Length <= 0) 
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Please enter a command as the first argument.  Try 'B2CGraphShell Help' for a list of commands.");
                Console.ForegroundColor = init;
                return;
            }

            try
            {
                switch (args[0].ToUpper())
                {
                    case "GET-USER": GetUser(args);
                        break;
                    case "CREATE-USER": CreateUser(args);
                        break;
                    case "UPDATE-USER": UpdateUser(args);
                        break;
                    case "DELETE-USER": DeleteUser(args);
                        break;
                    case "GET-EXTENSION-ATTRIBUTE": GetExtensionAttribute(args);
                        break;
                    case "CREATE-EXTENSION-ATTRIBUTE":
                        RegisterExtensionAttribute(args);
                        break;
                    case "GET-B2C-APPLICATION": GetB2CExtensionApplication(args);
                        break;
                    case "HELP": PrintHelp(args);
                        break;
                    case "SYNTAX": PrintSyntax(args);
                        break;
                    default:
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Invalid command.  Try 'B2CGraphShell Help' for a list of commands.");
                        break;
                }
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                if (ex.InnerException != null)
                {
                    Console.WriteLine(ex.InnerException.Message);
                }
                else 
                {
                    Console.WriteLine(ex.Message);                
                }
            }
            finally
            {
                Console.ForegroundColor = init;
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            init   = Console.ForegroundColor;
            client = new B2CGraphClient(clientId, clientSecret, tenant);

            if (args.Length <= 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Please enter a command as the first argument.  Try 'B2CGraphShell Help' for a list of commands.");
                Console.ForegroundColor = init;
                return;
            }

            try
            {
                switch (args[0].ToUpper())
                {
                case "GET-USER": GetUser(args);
                    break;

                case "CREATE-USER": CreateUser(args);
                    break;

                case "UPDATE-USER": UpdateUser(args);
                    break;

                case "DELETE-USER": DeleteUser(args);
                    break;

                case "GET-EXTENSION-ATTRIBUTE": GetExtensionAttribute(args);
                    break;

                case "DELETE-EXTENSION-ATTRIBUTE": DeleteExtensionAttribute(args);
                    break;

                case "GET-B2C-APPLICATION": GetB2CExtensionApplication(args);
                    break;

                case "HELP": PrintHelp(args);
                    break;

                case "SYNTAX": PrintSyntax(args);
                    break;

                default:
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Invalid command.  Try 'B2CGraphShell Help' for a list of commands.");
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                if (ex.InnerException != null)
                {
                    Console.WriteLine(ex.InnerException.Message);
                }
                else
                {
                    Console.WriteLine(ex.Message);
                }
            }
            finally
            {
                Console.ForegroundColor = init;
            }
        }