Take a survey

Developing Applications Using APIs > Working with LiveCycle ES Repository > Specifying Resource Relationships > Relating resources using the web service API

Relating resources using the web service API
To programmatically relate resources using the Repository web service API, perform the following tasks:
1.
2.
Using the Microsoft .NET client assembly, create a RepositoryServiceService object by invoking its default constructor. Set its Credentials property using a System.Net.NetworkCredential object containing the user name and password.
3.
Specify the URIs of the resources to be related. In this case, because the resources are named testResource1 and testResource2 and are located in the folder named testFolder, their URIs are "/testFolder/testResource1" and "/testFolder/testResource2". When using a language compliant with the Microsoft .NET Framework (for example, C#), the URIs are stored as a System.String objects. In this example, the resources are first written to the repository, and their URIs are retrieved. For more information about writing a resource, see Writing Resources.
4.
Invoke the RepositoryServiceService object’s createRelationship method and pass in the following parameters:
A boolean value indicating whether the relationship type was specified. In this example, the value true is specified.
A boolean value indicating whether the target resource is automatically updated to the Id-based identifier of the new head resource. In this example, because of the dependence relationship, the value true is specified.
A boolean value indicating whether the target head was specified. In this example, the value true is specified.
Pass null for the last parameter.
You can also retrieve a list of related resources for a given resource by invoking the RepositoryServiceService object’s getRelated method and passing in the following parameters:
A boolean value indicating whether the specified resource is the source resource in the relationship. In this example, the value true is specified because this is the case.
A boolean value indicating whether the source resource was specified. In this example, the value true is provided.
An array of integers containing the relationship types. In this example, a dependence relationship is specified by using the same value in the array as was used earlier: 3.
Pass null for the remaining two parameters.
The getRelated method returns an array of objects that can be cast to Resource objects through which you can iterate to retrieve each of the related resources. In this example, testResource2 is expected to be in the list of returned resources.
View Quick Start
 

 

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/repositoryCreatingRelationships.126.4.html