The following C# code example creates a folder called FormsFolder in /Applications/FormsApplication/1.0/.
After the folder is created, the path is written to the console.
(See Creating Folders.)
/*
* Ensure that you create a .NET client assembly that uses
* base64 encoding. This is required to populate a BLOB
* object with data or retrieve data from a BLOB object.
*
* For information, see "Invoking LiveCycle using Base64 Encoding"
* in Programming with LiveCycle
*/
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO;
namespace RepositoryWebService
{
class CreateFolder
{
[STAThread]
static void Main(string[] args)
{
try
{
//Create a RepositoryServiceService object
RepositoryServiceService repositoryClient = new RepositoryServiceService();
repositoryClient.Credentials = new System.Net.NetworkCredential("administrator", "password");
// Create a folder named FormsFolder
ResourceCollection testFolder = new ResourceCollection();
testFolder.id = new Id();
testFolder.lid = new Lid();
testFolder.name = "FormsFolder";
// Set the folder's description
testFolder.description = "Forms folder";
// Write the folder to /Applications/FormsApplication/1.0/
Resource newFolder = repositoryClient.writeResource("/Applications/FormsApplication/1.0/", testFolder, null, null);
// Retrieve the folder's path
String msg = "The path of the new folder is " + newFolder.path;
// Print folder verification message
Console.WriteLine(msg);
}
catch (Exception e)
{
Console.WriteLine(
"Exception thrown while trying to create the folder" +
e.Message
);
}
}
}
}
|
|
|