Setting Extended Attributes on Request resource

Feb 27, 2012 at 8:15 PM

A client wants to extended their Request object to hold a "Reason for Request" string attribute. 

This string will be available to the Owners to help determine if the Request should be approved or not.

I need a way to add multiple Requests for a Person resource to multiple Group resources, along with the text of the "Reason for Request".

The ReasonForRequest would not be a static string, but entered by the Requestor from the UI...

Code stub:

 

using (Microsoft.ResourceManagement.Client.DefaultClient client = 
		new DefaultClient(CredentialCache.DefaultNetworkCredentials))
{
    foreach (string groupID in requests)
    {
        foreach (RmResource rmResource in client.Enumerate("/Group[ObjectID='" + groupID + "']"))
        {
            RmGroup rmGroup = rmResource as RmGroup;
            if (rmGroup != null)
            {
                using (RmResourceChanges transaction = new RmResourceChanges(rmGroup))
                {
                    transaction.BeginChanges();
                    rmGroup.ExplicitMember.Add(targetReference);
                        // ToDo:
			// Modify the request message of the Put method:
			//   PutRequest resourceEPrequest = this.requestFactory.CreatePutRequest(transaction);
			//   RmAttributeName requestAttrName = new RmAttributeName("ReasonForRequest");
			//   RmAttributeValue requestAttrValue = new RmAttributeValue(false);
			//   requestAttrValue.Value = "because I said so...";
			//   resourceEPrequest.Attributes.Add(requestAttrName, requestAttrValue);
			//   this.wsTransferClient.Put(resourceEPrequest, out response);
			//   return true;
		        // Current:
		    client.Put(transaction);
                }
            }
            break;
        }
    }
}

I'm not sure if the WsTransfer schema request validation would even allow an additional attribute.  Has anyone else ever modified a request message?

Thanks,

-Mike

 

                     
Coordinator
Mar 2, 2012 at 2:01 PM

Since you asked the same question on the forum, I propose that we continue this discussion there, as others might be able to help: http://social.technet.microsoft.com/Forums/en/ilm2/thread/a88a4a3b-a7fa-4c32-9119-9ba305cb9274 

Cheers,
Paolo