QPR Knowledge Base 2012.1

SetAttributes

SetAttributes

Previous topic Next topic  

SetAttributes

Previous topic Next topic  

Revision history:

Introduced in QPR 8.1

 

Set a multiple attribute values objects defined in the objectIds parameter.

 

Synopsis:

 

void SetAttribute(string sessionId, string objectIds, string[][] attributes, string options)

 

Return Value:

 

None.

 

Parameters:

 

sessionId: String. ID of an authenticated session.

objectIds: String. A comma-separated list of FullID's of objects to which the attribute value should be added.

attributes. A Jagged two-dimensional array of strings. Each row in this array needs to contain an attribute name and the value assigned to the given attribute.

options: String. A comma-separated list of options for the command. Note that there can be also mandatory options specific to product and object type.

 

Example Procedure:

 

ServiceClient client = new ServiceClient("WSHttpBinding_IService");

string sessionId = client.Authenticate("qpr", "demo");

string[][] attributes = { new string[] { "Description", "Hello from QPR Web Services Foundation" }, new string[] { "Category", "Initiative" } };

string objectId = client.CreateObject(sessionId, "PO", "actionplan", "Action Plan created via WS API", "", attributes, "");

MessageBox.Show("Created object with ID " + objectId);

// add more attributes to the object

string[][] additionalAttributes = { new string[] { "Progress", "5" }, new string[] { "Status", "Waiting for approval" } };

client.SetAttributes(sessionId, objectId, additionalAttributes, "");

client.LogOff(sessionId);

client.Close();