private void ProgressReport(object importId) { var options = new ProgressBarOptions { ProgressCharacter = '_', ProgressBarOnBottom = false }; var pbar = new ProgressBar(100, $"\t Import Job Id : {importId}\t Connected : {CdsClient.ConnectedOrgFriendlyName}", options); while (true) { try { var job = CdsClient.Retrieve("importjob", (Guid)importId, new ColumnSet("solutionname", "progress", "completedon")); var progress = Convert.ToDecimal(job["progress"]); var completed = job.Attributes.ContainsKey("completedon") ? job["completedon"] : null; pbar.Tick(Convert.ToInt32(job["progress"])); if (progress == 100 || completed != null) { return; } } catch (Exception ex) { pbar.WriteLine(ex.Message); } Thread.Sleep(1000); } }
private void WhoAmI() { var whoAmIRequest = new WhoAmIRequest(); if (!(CdsClient.Execute(whoAmIRequest) is WhoAmIResponse whoAmIResponse)) { Console.WriteLine("Not Connected"); return; } var systemUser = CdsClient.Retrieve("systemuser", whoAmIResponse.UserId, new ColumnSet("firstname", "lastname", "domainname")); Console.WriteLine("Logged in as {0} {1} to {2}\n", systemUser.Attributes["firstname"], systemUser.GetAttributeValue <string>("lastname"), CdsClient.ConnectedOrgFriendlyName); Console.WriteLine("Organization Information:"); Console.WriteLine("\tOrg ID:\t{0}", CdsClient.ConnectedOrgId); Console.WriteLine("\tUnique Name:\t{0}", CdsClient.ConnectedOrgUniqueName); Console.WriteLine("\tFriendly Name:\t{0}", CdsClient.ConnectedOrgFriendlyName); Console.WriteLine("\tOrg Url:\t{0}", CdsClient.CdsConnectOrgUriActual); Console.WriteLine("\tUser Id:\t{0}", systemUser.Attributes["domainname"]); }