Click or drag to resize

ResourceManagementClientGetResource Method (String, Boolean)

Gets a resource from the resource management service, retrieving all attributes for the resource

Namespace:  Lithnet.ResourceManagement.Client
Assembly:  Lithnet.ResourceManagement.Client (in Lithnet.ResourceManagement.Client.dll) Version: 1.0.6435.24467
Syntax
public ResourceObject GetResource(
	string id,
	bool getPermissionHints
)

Parameters

id
Type: SystemString
The ID of the resource to get as a GUID in string format
getPermissionHints
Type: SystemBoolean
Gets the permission hints for each attribute of the resource

Return Value

Type: ResourceObject
The resource represented by the specified ID
Examples
The following example shows how to get an object from a known GUID value
Example
public ResourceObject GetResourceByGuidString(string id)
{
    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.GetResource(id);

        if (resource == null)
        {
            // The resource was not found, throw an exception
            throw new ResourceNotFoundException();
        }

        return resource;
    }
    catch (TooManyResultsException)
    {
        // More than one match was found
        throw;
    }
}
See Also