public CrmObject GetCrmConnection()
        {
            // Get the Url
            Mp.Prompt("Please enter the Url of the organization. E.g. 'http://www.contoso.com:5555/OrganizationName'\n");
            Url = Mp.Read();

            // Get the Domain
            Mp.Prompt("Please enter the Domain of the user.");
            Domain = Mp.Read();

            // Get the Username
            Mp.Prompt("Please enter the Username");
            Username = Mp.Read();

            // Get the Password
            Mp.Prompt("Please enter the Password");
            Password = Mp.ReadPassword();

            Mp.Prompt("\n\nChecking connection details...\n\n");
            // Check the credentials
            try
            {
                CrmConnection connection = CrmConnection.Parse(
                    "Url=" + Url + "; Domain=" + Domain + "; Username="******"; Password="******"The connection details supplied are not valid. Please enter the correct credentials");
                return(GetCrmConnection());
            }
        }
Beispiel #2
0
        private static void ChooseNextAction(MessagePrompter mp, string extractPath, List <EntityMeta> selectedEntities)
        {
            mp.Prompt("");
            mp.Prompt("Please choose what to do with the gathered attributes. Type in just the number.");
            mp.Prompt("[{0}] Show the attributes that have different display names and labels", (int)ActionList.ShowNonMatchingLabels);
            mp.Prompt("[{0}] Show attributes of the selected entity", (int)ActionList.ShowAllAttributes);
            mp.Prompt("[{0}] Exit", 0);

            var exit = false;

            while (!exit)
            {
                var resp            = mp.Read();
                var resultsFilePath = "";

                switch (Convert.ToInt32(resp))
                {
                case (0):
                    exit = true;
                    break;

                case ((int)ActionList.ShowNonMatchingLabels):
                    resultsFilePath = extractPath + "\\NonMatchingLabels.out";
                    ShowAllAttributes(resultsFilePath, selectedEntities, (att) =>
                                      !String.IsNullOrEmpty(att.Label) &&
                                      !att.IsLabelMatchingDisplayName);
                    mp.Prompt("Results are stored in the '{0}' file.", resultsFilePath);
                    break;

                case ((int)ActionList.ShowAllAttributes):
                    resultsFilePath = extractPath + "\\AllAttributes.out";
                    ShowAllAttributes(resultsFilePath, selectedEntities, (att) =>
                                      !String.IsNullOrEmpty(att.Label) &&
                                      !att.IsLabelMatchingDisplayName);
                    mp.Prompt("Results are stored in the '{0}' file.", resultsFilePath);
                    break;

                default:
                    mp.Prompt("Please choose a number between {0} and {1}.", 1, 2);
                    break;
                }

                mp.Prompt("");
                mp.Prompt("Please choose the next action.");
            }
        }