ResourceManagementClientGetResource Method (Guid, IEnumerableString) |
Gets a resource from the resource management service, retrieving only a specified set of attributes for the resource
Namespace:
Lithnet.ResourceManagement.Client
Assembly:
Lithnet.ResourceManagement.Client (in Lithnet.ResourceManagement.Client.dll) Version: 1.0.6435.24467
Syntaxpublic ResourceObject GetResource(
Guid id,
IEnumerable<string> attributesToGet
)
Public Function GetResource (
id As Guid,
attributesToGet As IEnumerable(Of String)
) As ResourceObject
public:
ResourceObject^ GetResource(
Guid id,
IEnumerable<String^>^ attributesToGet
)
Parameters
- id
- Type: SystemGuid
The ID of the resource to get - attributesToGet
- Type: System.Collections.GenericIEnumerableString
The list of attributes to retrieve
Return Value
Type:
ResourceObjectThe resource represented by the specified ID
Examples
The following example shows how to get an object from a known GUID value
public ResourceObject GetResourceByGuid(Guid id)
{
ResourceManagementClient client = new ResourceManagementClient();
List<string> attributesToGet = new List<string>() { "DisplayName", "FirstName", "LastName" };
try
{
ResourceObject resource = client.GetResource(id);
if (resource == null)
{
throw new ResourceNotFoundException();
}
return resource;
}
catch (TooManyResultsException)
{
throw;
}
}
See Also