Take a survey

API Quick Starts (Code Examples) > Repository Service API Quick Starts > Quick Start: Reading a resource using the web service API

Quick Start: Reading a resource using the web service API
The following C# code example reads a resource called testResource from the repository.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO;
 
namespace RepositoryWebService
{
	class ReadFile
	{
		[STAThread]
		static void Main(string[] args)
		{
            // This example will retrieve a resource from the LiveCycle ES repository
            try
			{
				//Create a RepositoryServiceService object
				RepositoryServiceService repositoryClient = new RepositoryServiceService();
				repositoryClient.Credentials = new System.Net.NetworkCredential("administrator", "password");
 
                // Specify the URI of the resource to be retrieved
                String resourceUri = "/testFolder/testResource";
 
                // Retrieve the resource 
                Resource r = repositoryClient.readResource(resourceUri, null, null);
 
			    // Print the resource verification message
			    Console.WriteLine(
				    "Resource " + 
				    resourceUri +
                    " was successfully retrieved."
                );
            }
			catch (Exception e)
			{
                Console.WriteLine(
                    "Exception thrown while trying to read the file" + 
                    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.9.html