|
|
The following C# code example deletes a resource called testResourceToBeDeleted in the repository.using System;using System.Collections;using System.ComponentModel;using System.Data;using System.IO;namespace RepositoryWebService{class DeleteResource{[STAThread]static void Main(string[] args){// This example will delete a resource from the LiveCycle ES repository.// First, a resource will be created and written to the repository.// That resource will then be deleted from the repository.try{//Create a RepositoryServiceService objectRepositoryServiceService repositoryClient = new RepositoryServiceService();repositoryClient.Credentials = new System.Net.NetworkCredential("administrator", "password");// Specify the URI of the target folder for writing the resourceString testFolderUri = "/testFolder";// Create the resource to be written to the folderResource testResource = new Resource();testResource.id = new Id();testResource.lid = new Lid();testResource.name = "testResourceToBeDeleted";testResource.description = "test resource to be deleted";// Write the resource to the folderrepositoryClient.writeResource(testFolderUri, testResource, null, null);// Retrieve the resource’ URIString resourceUri = testFolderUri + "/" + testResource.name;// Retrieve the resource to verify that it was successfully writtenResource r = repositoryClient.readResource(resourceUri, null, null);// Print the resource verification messageConsole.WriteLine("Resource " + resourceUri + " was successfully written.");// Delete the resourcestring[] uris = new string[1];uris[0] = resourceUri;repositoryClient.deleteResources(uris, null);// Verify that the resource has been deletedtry {// Attempt to read the nonexistent resource,// which will cause an exception if the resource was deleted.BLOB doc = repositoryClient.readResourceContent(resourceUri, null);} catch (Exception re) {// Indicate successful deletionConsole.WriteLine("Resource " + resourceUri + " was successfully deleted.");}}catch (Exception e){Console.WriteLine("Exception thrown while trying to delete the resource" +e.Message);}}}}
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/quickStarts_Repository.18.20.html