Set Package Folder

Description

Moves a package to the specified folder in CMS.


Syntax

SetPackageFolder(Byval PackageName as String, Byval PackageVersion as String, Byval PackageType as String, Byval FolderStructure as String, Byval ChangelogText as String) as Boolean


Parameters

PackageName (String)

The name of the package

PackageVersion (String)

Package version

PackageType (String)

Type of package

  • "Computer"
  • "User"

FolderStructure (String)

A string representation of the folder structure, example: newFolder\newFolder2
If one or more of the folders doesn't exist, they are created.
If this is an empty string, the package is removed from its current folder, and moved to the root.

ChangelogText (String)

This will be added to the changelog in CMS.


Return value

Boolean. The function returns true if it succeeds, otherwise false.


Example 1

This example moves the Hardware inventory package,  to a folder 'NewFolder2', on management point 1

VBScript
Set oCMS = CreateObject("CapaInstaller.SDK") 
wscript.echo oCMS.SetDefaultManagementPoint("1") 
Wscript.echo oCMS.SetPackageFolder("HWInventory", "v4.1", "Computer", "NewFolder\NewFolder2", "Moved package via sdk") 


Example 2

This example retrieves all computer packages in management point 1 and places them in a folder named 'NewFolder2'

VBScript
Set oCMS = CreateObject("CapaInstaller.SDK") 
wscript.echo oCMS.SetDefaultManagementPoint("1") 
Set arrPackages = CreateObject("System.Collections.ArrayList") 
Set arrPackages = oCMS.GetPackages("Computer") 
for each item in arrPackages 
  arr=Split(item,"|") 
  sPackageName = arr(0)
  sPackageVersion = arr(1) 
  sPackageType = arr(2)   
  sPackageInfo = "Package Name: " & sPackageName & " Version: " & sPackageVersion & " Type: " & sPackageType   
  Wscript.echo "Moving '" & sPackageInfo & "' to folder: 'NewFolder\NewFolder2'" 
  Wscript.echo oCMS.SetPackageFolder(sPackageName, sPackageVersion, sPackageType, "NewFolder\NewFolder2", "Package moved via sdk") 
next 


Example 3

This example retrieves all computer packages in management point 2, and copies their folder structure to packages in management point 1

VBScript
Set oCMS = CreateObject("CapaInstaller.SDK") 
wscript.echo oCMS.SetDefaultManagementPoint("2") 
on error resume next 
Set arrPackages = CreateObject("System.Collections.ArrayList") 
Set arrPackages = oCMS.GetPackages("Computer") 
for each item in arrPackages 
  arr=Split(item,"|") 
  sPackageName = arr(0)
  sPackageVersion = arr(1) 
  sPackageType = arr(2)   
  sPackageInfo = "Package Name: " & sPackageName & " Version: " & sPackageVersion & " Type: " & sPackageType   
  oCMS.SetDefaultManagementPoint("2") 
  sFolderStructure = oCMS.GetPackageFolder(sPackageName, sPackageVersion, sPackageType) 
  oCMS.SetDefaultManagementPoint("1") 
  Wscript.echo oCMS.SetPackageFolder(sPackageName, sPackageVersion, sPackageType, sFolderStructure, "Package moved via sdk") 
  Wscript.echo sPackageInfo & " Struct: " & sFolderStructure 
next


 
 
 
Â