Create a set programmatically

In answering a recent question, I provided an example of how to create a set programmatically.  Creating a set is no different than creating a group or person with one caveat.  A set requires a display name and a filter.  The display name is a simple string as expected, but the filter is a string that must contain a WS-Enumeration filter element.  Looking at schema alone you – and I – would assume to simply provide the XPath filter in the attribute value.  Instead you must wrap the XPath filter in the XML WS-Enumeration filter element.

Here is a working example from Release Candidate of ILM “2’ and the public client:

ResourceManagementObject rmObject = new ResourceManagementObject("Set");

rmObject["DisplayName"] = new ResourceManagementAttribute("DisplayName", "CreatedSet");

rmObject["Filter"] = new ResourceManagementAttribute("Filter", "<Filter xmlns:xsi=\"\" xmlns:xsd=\"\" Dialect=\"\" xmlns=\"\">/Person</Filter>");


String newGroupId = transferClient.Create(rmObject);

Hope that helps!