QPR Knowledge Base 2015.1

AddReference

AddReference

Previous topic Next topic No directory for this topic  

AddReference

Previous topic Next topic Topic directory requires JavaScript Mail us feedback on this topic!  

Revision history:

Introduced in QPR 8.1

 

Add references to objects (defined in targetObjectIds) into referenceAttribute of objects defined by objectIds. Reference attributes define relations between objects and e.g. Portal actions have parents and external parents as reference attributes.

 

Synopsis:

 

void AddReference(string sessionId, string objectIds, string referenceAttribute, string targetObjectIds, 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 be modified (i.e. which gain references to target objects).

referenceAttribute: String. Name of the reference attribute.

targetObjectIds: String. A comma-separated list of FullID's of object to which references should be created.

options: String. A comma-separated list of options.

 

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, "");

string[][] attributesForCopy = { new string[] { "Description", "Copied object" }, new string[] { "Category", "Initiative"} };

string copiedObjectId = client.CreateCopy(sessionId, objectId, "", attributesForCopy, "");

// set the first object as the parent for the copied object

client.AddReference(sessionId, copiedObjectId, "parentobjects", objectId, "");

client.LogOff(sessionId);

client.Close();