Today we are going to create a new group using web services. To create a new group, like creating any object in ILM, you must provide a starting value that includes all of the required attributes. In the case of a group, we need to set a few more attributes than we would with other objects because groups are so important to the system. Our example below includes the necessary attributes for a group. To see which attributes are required for ILM objects, re-visit the previous post about getting ILM schema and look at the required attribute bindings or explore the schema in the ILM portal. I will leave both as an exercise to the reader since doing is the best way to learn.
(Hint: Output binding[“Required”].AttributeSingleValue.ToString(). If true, you must include the attribute).
The code to create a group:
I hope you agree that this code is straight-forward. We create a new object, set a bunch of required attributes, and then pass the object to create. We then get back the object’s ID in the create response, which we then can use for getting the object or searching for it in enumerations.
The only tricky part to creating an object is, as I originally mentioned, to ensure all required attributes are present and that they are in the correct format. Please explore creating new objects including any custom objects you may have added. If things keep failing, turn on WCF message tracing and watch how the portal does it.
I uploaded the sample create request on the code gallery site so you can compare what an ILM “2” RC request should look like. Happy exploring!