Ejemplo n.º 1
0
        static int Main(string[] args)
        {
            ConsoleColor defaultForeground = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter the URL of the Source MMS.");
            Console.ForegroundColor = defaultForeground;
            string _sourceUrl = Console.ReadLine();

            if (_sourceUrl == "")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Enter the URL of the Source MMS.");
                Console.ForegroundColor = defaultForeground;
                _sourceUrl = Console.ReadLine();

                if (_sourceUrl == "")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("No SharePoint Online site url was provided. Exiting application.");
                    Console.WriteLine("Press any key to continue...");
                    Console.ForegroundColor = defaultForeground;
                    Console.ReadLine();
                    return(1);
                }
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter your user name (ex: [email protected]):");
            Console.ForegroundColor = defaultForeground;
            string _sourceUserName = Console.ReadLine();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter your password:"******"Enter the URL of the target MMS:");
            Console.ForegroundColor = defaultForeground;
            string _targetUrl = Console.ReadLine();

            if (_targetUrl == "")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Enter the URL of the Source MMS SharePoint Online site");
                Console.ForegroundColor = defaultForeground;
                _sourceUrl = Console.ReadLine();

                if (_targetUrl == "")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("No SharePoint site url was provided. Exiting application.");
                    Console.WriteLine("Press any key to continue...");
                    Console.ForegroundColor = defaultForeground;
                    Console.ReadLine();
                    return(1);
                }
            }
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter your user name (ex: [email protected]):");
            Console.ForegroundColor = defaultForeground;
            string _targetUserName = Console.ReadLine();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter your password:"******"Select the type of operation you would like to perform:");
            Console.ForegroundColor = defaultForeground;
            Console.WriteLine(" 1 (Enter 1 for Move Term Group)");
            Console.WriteLine(" 2 (Enter 2 for Process Changes)");
            string opsTypeSelection = Console.ReadLine();

            if (opsTypeSelection == null || opsTypeSelection != "1" && opsTypeSelection != "2")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Try again. Select the type of operation you would like to perform:");
                Console.ForegroundColor = defaultForeground;
                Console.WriteLine(" 1 (Enter 1 for Move Term Group)");
                Console.WriteLine(" 2 (Enter 2 for Process Changes)");
                opsTypeSelection = Console.ReadLine();

                if (opsTypeSelection == null || opsTypeSelection != "1" && opsTypeSelection != "2")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("The correct options were not specified. Exiting application.");
                    Console.WriteLine("Press any key to continue...");
                    Console.ForegroundColor = defaultForeground;
                    Console.ReadLine();
                    return(1);
                }
            }



            if (opsTypeSelection == "1")
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Enter the TermGroup Name you wish to move.");
                Console.ForegroundColor = defaultForeground;
                string _termGroup = Console.ReadLine();
                if (string.IsNullOrEmpty(_termGroup))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Term Group Name is empty. I can not work on it.");
                    Console.WriteLine("Press any key to continue...");
                    Console.ForegroundColor = defaultForeground;
                    Console.ReadLine();
                    return(1);
                }
                MMSSyncManager _manager = new MMSSyncManager();
                _manager.MoveTermGroup(_ctxSource, _ctxTarget, _termGroup);
            }
            else if (opsTypeSelection == "2")
            {
                string[] _termsetInput;
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Enter the Termset to Sync, (ex: Fruit, Colors)");
                Console.ForegroundColor = defaultForeground;
                _termsetInput           = Console.ReadLine().Split(new char[] { ',' });


                List <string> _termSets = new List <string>(_termsetInput);

                MMSSyncManager _manager = new MMSSyncManager();
                _manager.ProcessChanges(_ctxSource, _ctxTarget, _termSets);
            }

            Console.WriteLine("I worked on it for you.");
            return(0);
        }
Ejemplo n.º 2
0
        static int Main(string[] args)
        {
            ConsoleColor defaultForeground = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter the URL of the Source MMS.");
            Console.ForegroundColor = defaultForeground;
            string _sourceUrl = Console.ReadLine();

            if (_sourceUrl == "")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Enter the URL of the Source MMS.");
                Console.ForegroundColor = defaultForeground;
                _sourceUrl = Console.ReadLine();

                if (_sourceUrl == "")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("No SharePoint Online site url was provided. Exiting application.");
                    Console.WriteLine("Press any key to continue...");
                    Console.ForegroundColor = defaultForeground;
                    Console.ReadLine();
                    return 1;
                }
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter your user name (ex: [email protected]):");
            Console.ForegroundColor = defaultForeground;
            string _sourceUserName = Console.ReadLine();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter your password:"******"Enter the URL of the target MMS:");
            Console.ForegroundColor = defaultForeground;
            string _targetUrl = Console.ReadLine();

            if (_targetUrl == "")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Enter the URL of the Source MMS SharePoint Online site");
                Console.ForegroundColor = defaultForeground;
                _sourceUrl = Console.ReadLine();

                if (_targetUrl == "")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("No SharePoint site url was provided. Exiting application.");
                    Console.WriteLine("Press any key to continue...");
                    Console.ForegroundColor = defaultForeground;
                    Console.ReadLine();
                    return 1;
                }
            }
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter your user name (ex: [email protected]):");
            Console.ForegroundColor = defaultForeground;
            string _targetUserName = Console.ReadLine();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter your password:"******"Select the type of operation you would like to perform:");
            Console.ForegroundColor = defaultForeground;
            Console.WriteLine(" 1 (Enter 1 for Move Term Group)");
            Console.WriteLine(" 2 (Enter 2 for Process Changes)");
            string opsTypeSelection = Console.ReadLine();

            if (opsTypeSelection == null || opsTypeSelection != "1" && opsTypeSelection != "2")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Try again. Select the type of operation you would like to perform:");
                Console.ForegroundColor = defaultForeground;
                Console.WriteLine(" 1 (Enter 1 for Move Term Group)");
                Console.WriteLine(" 2 (Enter 2 for Process Changes)");
                opsTypeSelection = Console.ReadLine();

                if (opsTypeSelection == null || opsTypeSelection != "1" && opsTypeSelection != "2")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("The correct options were not specified. Exiting application.");
                    Console.WriteLine("Press any key to continue...");
                    Console.ForegroundColor = defaultForeground;
                    Console.ReadLine();
                    return 1;
                }
            }

            

            if (opsTypeSelection == "1")
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Enter the TermGroup Name you wish to move.");
                Console.ForegroundColor = defaultForeground;
                string _termGroup = Console.ReadLine();
                if(string.IsNullOrEmpty(_termGroup))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Term Group Name is empty. I can not work on it.");
                    Console.WriteLine("Press any key to continue...");
                    Console.ForegroundColor = defaultForeground;
                    Console.ReadLine();
                    return 1;
                }
                MMSSyncManager _manager = new MMSSyncManager();
                _manager.CopyTermGroup(_ctxSource, _ctxTarget, _termGroup);

            }
            else if (opsTypeSelection == "2")
            {
                string[] _termsetInput;
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Enter the Termset to Sync, (ex: Fruit, Colors)");
                Console.ForegroundColor = defaultForeground;
                _termsetInput = Console.ReadLine().Split(new char[]{','});


                List<string> _termSets = new List<string>(_termsetInput);

                MMSSyncManager _manager = new MMSSyncManager();
                _manager.ProcessChanges(_ctxSource, _ctxTarget, DateTime.Now.AddYears(-1), null, _termSets);
            }

            Console.WriteLine("I worked on it for you.");
            return 0;   
        }