This project has moved. For the latest updates, please go here.

Getting started - Quick Reference

The Lithnet Resource Management Client is designed to be easy to use and get started
  1. Create a new project in Visual Studio
  2. Ensure Microsoft.ResourceManagement.dll is registered in the GAC (you can find this on your FIM service server)
  3. Install the nuget package from the Package Manager Console in Visual Studio
  4. Update the app.config or web.config file to point to your FIM service server
<lithnetResourceManagementClient resourceManagementServiceBaseAddress="http://fimsvc-sspr:5725" />

Now you can start coding. This simple app demonstrates the basic get, search, update, and create operations.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lithnet.ResourceManagement.Client;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create an instance of the resource management client
            ResourceManagementClient client = new ResourceManagementClient();
            // Get the resource with the account name 'testuser'
            ResourceObject resource = client.GetResourceByKey("Person", "AccountName", "testuser");
            // Write the object to the console
            Console.WriteLine(resource.ToString());

            // Get a single attribute
            Console.WriteLine(resource.Attributes["AccountName"].StringValue);

            // Change an attribute
            resource.Attributes["AccountName"].SetValue("NewUsername");

            // Save the resource to the fim service
            resource.Save();

           // Create a new object
            ResourceObject newResource = client.CreateResource("Person");
            newResource.Attributes["AccountName"].SetValue("MyNewAccount");
            newResource.Attributes["Domain"].SetValue("FIM-DEV1");

            // Save the new object to the fim service
            newResource.Save();

            // Search for the newly created object by anchor
            ResourceObject foundObject = client.GetResourceByKey("Person", "AccountName", "MyNewAccount");
           
            // Delete the object
            client.DeleteResource(foundObject);

            // Print the values of the object
            Console.WriteLine(foundObject.ToString());

            // Search for all Sets
            foreach (ResourceObject result in client.GetResources("/Set"))
            {
                Console.WriteLine(result.ToString());
            }
        }
    }
}

Last edited Aug 21, 2015 at 4:27 AM by ryannewington, version 4