Automating Export via API - VisualCron - Forum

Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline J Haas  
#1 Posted : Monday, April 25, 2016 4:49:47 PM(UTC)
J Haas

Rank: Paid support

Joined: 8/8/2014(UTC)
Posts: 9
United States

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?

Edited by moderator Thursday, June 1, 2017 5:25:26 PM(UTC)  | Reason: Not specified

Offline Support  
#2 Posted : Monday, February 13, 2017 10:03:18 PM(UTC)
Support

Rank: Official support

Joined: 2/23/2008(UTC)
Posts: 11,258

Thanks: 877 times
Was thanked: 450 time(s) in 427 post(s)
Sorry for the late reply. Here is from the test project:
Code:

 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!
Offline rst3b  
#3 Posted : Friday, May 26, 2017 10:47:10 PM(UTC)
rst3b

Rank: No customer

Joined: 10/6/2016(UTC)
Posts: 14
United States
Location: North Carolina, Jamestown

Was thanked: 1 time(s) in 1 post(s)
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!

Code:

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();

                }
Offline Support  
#4 Posted : Monday, May 29, 2017 8:34:05 PM(UTC)
Support

Rank: Official support

Joined: 2/23/2008(UTC)
Posts: 11,258

Thanks: 877 times
Was thanked: 450 time(s) in 427 post(s)
Originally Posted by: rst3b Go to Quoted Post
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!

Code:

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

Code:
        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!
Offline rst3b  
#5 Posted : Thursday, June 1, 2017 5:05:51 PM(UTC)
rst3b

Rank: No customer

Joined: 10/6/2016(UTC)
Posts: 14
United States
Location: North Carolina, Jamestown

Was thanked: 1 time(s) in 1 post(s)
Thanks that got me where I needed to go.!
thanks 1 user thanked rst3b for this useful post.
Support on 6/1/2017(UTC)
Users browsing this topic
Guest (2)
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Scroll to Top