Click or drag to resize
IQMS2SetQVPRAPISettings Method
Sets QVPR settings.

Namespace: PIX.Services.V12.Api2
Assembly: 
Syntax
string SetQVPRAPISettings(
	QVPRAPISettings qvprSettings,
	bool doMigrate
)

Parameters

qvprSettings
Type: PIX.QMSAPI.DataObjectsQVPRAPISettings
QVPRAPISettings that should be saved.
doMigrate
Type: SystemBoolean
Boolean value indicating if the migration of the QVPR data should be done. If set to false, the saved database will be empty.

Return Value

Type: String
Empty string if the settings are successfully set, otherwise an error message
Remarks
Security note Security Note

Requires membership of local groups QlikView Management API and QlikView Administrator.

Examples
The following code example uses the QMS API to retrieve QVPR XML settings. It changes the QVPR backup path and then saves the QVPR settings. If everything goes well, it prints the original backup path and then a message when it's done. If anything goes wrong, it prints an error message.

The service key injection is assumed to be handled behind the scenes. For an example of how to inject the service key, see Samples.

C#
using System;
using System.Collections.Generic;
using QMSAPI;

class Program
{
    static void Main(string[] args)
    {
        try
        {
            // create a QMS API client
            IQMS2 apiClient = new QMS2Client();

            //retrieve a time limited service key
            ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

            // get QVPR settings
            QVPRAPISettings settings = apiClient.GetQVPRAPISettings();
            if (settings != null)
            {
                // retrieve and print current backup path
                Console.WriteLine("XML backup path before change: " + settings.XmlBackupPath);
                // change XML backup path
                settings.XMLBackupPath = @"\\myfolder\backup";
                // save settings
                apiClient.SetQVPRAPISettings(settings, true);
                Console.WriteLine("Settings saved. XML backup path changed.");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("An exception occurred: " + ex.Message);
        }
        // wait for user to press any key
        Console.ReadKey();
    }
}
See Also