Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


J Haas
2016-04-25T14:49:47Z
I am trying to automate the export of jobs and other dependent objects for use within our automated deployment. I see the Server class supports a "RaiseImportExportProgress" method, which does fire the appropriate event, but nothing ever comes through the Progress object. Is this type of functionality currently supported within 7.7.8?
Sponsor
Forum information
Support
2017-02-13T21:03:18Z
Sorry for the late reply. Here is from the test project:

 if (s != null)
            {
                if (s.Connected)
                {
                    ExportImportProgressClass eip = new ExportImportProgressClass();
                    //eip.UseDefaultFile = true; // saves to default backup folder in program files/VisualCron/backup/VC-Settings.zip
                    eip.UseDefaultFile = false; // file will not be saved but instead you will retrieve eip.File which is a byte array you can save to file
                    eip.IncludeAllCertificates = true;
                    //eip.CertificatesObjects = s.Certificates.GetAll(); // include any CertificateClass you want to export
                    eip.IncludeAllConditions = true;
                    //eip.ConditionsObjects = s.Conditions.GetAll(); // include any ConditionSetClass you want to export
                    eip.IncludeAllConnections = true;
                    eip.IncludeAllCredentials = true;
                    eip.IncludeAllExitCodes = true;
                    eip.IncludeAllNetworkDrives = true;
                    eip.IncludeAllNotifications = true;
                    eip.IncludeAllPermissions = true;
                    eip.IncludeAllPGPKeyRings = true;
                    eip.IncludeAllServerSettings = true;
                    eip.IncludeAllTimeExceptions = true;
                    eip.IncludeAllUserGroups = true;
                    eip.IncludeAllVariables = true;
                    //eip.IncludeAllJobs = true;
                    eip.IncludeAllJobs = false;
                    eip.JobObjects = s.Jobs.GetAll(); // add any Job classes you want to export

                    ExportSettingsResponseClass esrc = s.ExportSettings(eip);
                    if (esrc.Success && esrc.FileBytes!=null)
                    {
                        if (!eip.UseDefaultFile)
                        {
                            System.IO.File.WriteAllBytes("c:/VC-Settings.zip", esrc.FileBytes);
                        }
                    }
                }
            }

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
rst3b
2017-05-26T20:47:10Z
I'm running into issues using this example code. I am attempting to only export specific jobs. When using the eip.JobObjects variable and passing JobClasses I am getting null for the esrc.FileBytes value even when I use the Jobs.GetAll() to pass all of them. However I am able to receive an output when using the eip.IncludeAllJobs = true value. The commented sections in the below code are my attempts to pass only specific jobs to no avail. Thanks for any help!


if (s.Connected)
                {
                    Console.WriteLine("Connected to Server");

                    ExportImportProgressClass eip = new ExportImportProgressClass();
                    eip.UseDefaultFile = false;
                    eip.IncludeAllCertificates = false;
                    eip.IncludeAllConditions = false;
                    eip.IncludeAllConnections = false;
                    eip.IncludeAllCredentials = false;
                    eip.IncludeAllExitCodes = false;
                    eip.IncludeAllNetworkDrives = false;
                    eip.IncludeAllNotifications = false;
                    eip.IncludeAllPermissions = false;
                    eip.IncludeAllPGPKeyRings = false;
                    eip.IncludeAllServerSettings = false;
                    eip.IncludeAllTimeExceptions = false;
                    eip.IncludeAllUserGroups = false;
                    eip.IncludeAllVariables = false;
                    eip.IncludeAllJobs = false;

                    /*var jobs = (from j in s.Jobs.GetAll()
                    where j.Group == "WD Standard"
                    select j.Name).ToList();*/

                    //eip.Jobs = jobs;
                    //eip.JobObjects = s.Jobs.GetAll().Where(item => item.Group == "WD Standard").ToList();
                    eip.JobObjects = s.Jobs.GetAll();

                    ExportSettingsResponseClass esrc = s.ExportSettings(eip);

                    if (esrc.Success && esrc.FileBytes != null)
                    {
                        System.IO.File.WriteAllBytes("C:/Temp/VC-Settings.zip", esrc.FileBytes);
                    }

                    s.Disconnect();

                }
Support
2017-05-29T18:34:05Z
Originally Posted by: rst3b 

I'm running into issues using this example code. I am attempting to only export specific jobs. When using the eip.JobObjects variable and passing JobClasses I am getting null for the esrc.FileBytes value even when I use the Jobs.GetAll() to pass all of them. However I am able to receive an output when using the eip.IncludeAllJobs = true value. The commented sections in the below code are my attempts to pass only specific jobs to no avail. Thanks for any help!


if (s.Connected)
                {
                    Console.WriteLine("Connected to Server");

                    ExportImportProgressClass eip = new ExportImportProgressClass();
                    eip.UseDefaultFile = false;
                    eip.IncludeAllCertificates = false;
                    eip.IncludeAllConditions = false;
                    eip.IncludeAllConnections = false;
                    eip.IncludeAllCredentials = false;
                    eip.IncludeAllExitCodes = false;
                    eip.IncludeAllNetworkDrives = false;
                    eip.IncludeAllNotifications = false;
                    eip.IncludeAllPermissions = false;
                    eip.IncludeAllPGPKeyRings = false;
                    eip.IncludeAllServerSettings = false;
                    eip.IncludeAllTimeExceptions = false;
                    eip.IncludeAllUserGroups = false;
                    eip.IncludeAllVariables = false;
                    eip.IncludeAllJobs = false;

                    /*var jobs = (from j in s.Jobs.GetAll()
                    where j.Group == "WD Standard"
                    select j.Name).ToList();*/

                    //eip.Jobs = jobs;
                    //eip.JobObjects = s.Jobs.GetAll().Where(item => item.Group == "WD Standard").ToList();
                    eip.JobObjects = s.Jobs.GetAll();

                    ExportSettingsResponseClass esrc = s.ExportSettings(eip);

                    if (esrc.Success && esrc.FileBytes != null)
                    {
                        System.IO.File.WriteAllBytes("C:/Temp/VC-Settings.zip", esrc.FileBytes);
                    }

                    s.Disconnect();

                }



Hi, you should use

        Dim eip As New ExportImportProgressClass
        If Not eip.IncludeAllJobs Then
            eip.Jobs = ' the Job id's you want to export
        End If

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
rst3b
2017-06-01T15:05:51Z
Thanks that got me where I needed to go.!
Similar Topics
Users browsing this topic
Scroll to Top