Creating Publisher Folders Using IDK Remote APIs
To create folders using the IDK remote Publisher API, use
the IFolderManager interface.
The
IFolderManager interface includes
the
createFolder method with two parameters: the
target folder and the new folder name. (To rename a folder, use
IFolder.setName.) A folder name cannot have more than 255
characters. Publisher ignores capitalization and spaces in the characters.
You must invoke
IFolder.store to store the newly
created folder.
Note: When you create a new folder with the IDK remote
Publisher API, it inherits the security of its parent folder. To configure
folder security, you must use Publisher Explorer.
- Create a PRC session. For details, see Initiating a PRC Session to Use IDK Remote APIs.
- Get a Content Factory object using IRemoteSession.getContentFactory.
- Get a Folder Manager, retrieve the target folder, and create
the new folder as shown in the code samples below.
- To retrieve the root folder, use IFolderManager.getRootFolder.
- To retrieve the subfolder of the current folder, use IFolderManager.getSubFolder. (To retrieve all the folders
in Publisher, retrieve the root folder with the getRootFolder method, then retrieve all subfolders with the getSubFolder method.)
- To retrieve a folder by UUID, use IFolderManager.getFolder. (To obtain the UUID of a folder, use IFolder.getUUID.)
- To retrieve a folder by path, use IFolderManager.getFolderByPath. (To obtain the path of a folder, use IFolder.getPath.)
The examples below create a folder in the root Publisher directory.
- Call store to persist the folder; it
will not exist in Publisher until this call is executed.
Java
...
// Get a folder manager for working with Publisher folders.
IFolderManager folderManager = factory.getFolderManager();
// Retrieve the Publisher root folder, which always exists.
IFolder rootFolder = folderManager.getRootFolder();
// Create a new folder.
IFolder subFolder = folderManager.createFolder(rootFolder, "Java Example - Support Incidents");
subFolder.store();
...
.NET (C#)
...
// Get a folder manager for working with Publisher folders.
IFolderManager folderManager = factory.GetFolderManager();
// Retrieve the Publisher root folder, which always exists.
IFolder rootFolder = folderManager.GetRootFolder();
// Create a new folder.
IFolder subFolder = folderManager.CreateFolder(rootFolder, ".NET Example - Support Incidents");
subFolder.Store();
...
.NET (VB)
...
' Get a folder manager for working with Publisher folders.
Dim folderManager As IFolderManager = factory.GetFolderManager()
' Get a reference to the root folder. It always exists.
Dim rootFolder As IFolder = folderManager.GetRootFolder()
' Create a new folder.
subFolder = folderManager.CreateFolder(rootFolder, "VB.NET Web Example - DET")
subFolder.Store()
...