Click or drag to resize

ResourceManagementClientCreateResource Method

Creates a template of a new object that can be used to save to the resource management service at a later stage

Namespace:  Lithnet.ResourceManagement.Client
Assembly:  Lithnet.ResourceManagement.Client (in Lithnet.ResourceManagement.Client.dll) Version: 1.0.6435.24467
Syntax
public ResourceObject CreateResource(
	string objectType
)

Parameters

objectType
Type: SystemString
The object type to create

Return Value

Type: ResourceObject
An empty template of a new object that will be created in the resource management service when saved
Examples
The following example shows how to create a new resource in the Resource Management Service
Example
public void CreateResouruce()
{
    ResourceManagementClient client = new ResourceManagementClient();

    // Create a template for a resource object
    ResourceObject resource = client.CreateResource("Person");

    resource.Attributes["AccountName"].SetValue("user0001");
    resource.Attributes["Domain"].SetValue("FIM-DEV1");
    resource.Attributes["DisplayName"].SetValue("Test user 1");

    try
    {
        resource.Save();
    }
    catch (Exception)
    {
        // An error occurred while creating the resource
        throw;
    }
}
See Also