ResourceManagementClientGetResource Method (UniqueIdentifier) |
Namespace: Lithnet.ResourceManagement.Client
public ResourceObject GetResourceByReference() { ResourceManagementClient client = new ResourceManagementClient(); // Specify the list of attributes that we are interested in List<string> attributesToGet = new List<string>() { "DisplayName", "FirstName", "LastName" }; try { ResourceObject resource = client.GetResourceByKey("Person", "AccountName", "user0001", attributesToGet); if (resource == null) { // The resource was not found, throw an exception throw new ResourceNotFoundException(); } // Return the resource referenced by user0001's Manager attribute return client.GetResource(resource.Attributes["Manager"].ReferenceValue); } catch (TooManyResultsException) { // More than one match was found throw; } }