The following C# code example updates /Applications/FormsApplication/1.0/FormsFolder by modifying
its description. (See Updating Resources.)
/*
* 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 UpdateResource
{
[STAThread]
static void Main(string[] args)
{
// This example will update a resource in the LiveCycle repository.
// First, a resource will be retrieved from the repository.
// Then, that resource's description is updated.
try
{
//Create a RepositoryServiceService object
RepositoryServiceService repositoryClient = new RepositoryServiceService();
repositoryClient.Credentials = new System.Net.NetworkCredential("administrator", "password");
// Specify the URI of the resource to update
String resourceUri = "/Applications/FormsApplication/1.0/FormsFolder";
// Retrieve the resource
Resource resource = repositoryClient.readResource(resourceUri, null, null);
// Update its description
resource.description = "Updated resource";
// Update the resource in the repository
Resource updatedResource = repositoryClient.updateResource(
resourceUri,
resource,
true,
null,
null);
// Print the resource verification message
Console.WriteLine(
"Resource " +
resourceUri +
"version " +
updatedResource.majorVersion +
"." +
updatedResource.minorVersion +
" was successfully updated."
);
}
catch (Exception e)
{
Console.WriteLine(
"Exception thrown while trying to update the resource" +
e.Message
);
}
}
}
}
|
|
|