Revision history:
Introduced in QPR 8.1
Last changed in QPR 2026.1
Create QPR object of defined type so that name, parent object(s) and set of attribute values are set to the new object. FullID of the created object is returned.
Synopsis:
string CreateObject(string sessionId, string namespaceId, string objectTypeName, string name, string parentIds, string[][] attributes, string options)
Return Value:
FullID of the created object as string.
Parameters:
sessionId: String. ID of an authenticated session.
namespaceId: String. ID of the namespace into which the object is to be created. The following namespaces are supported at the moment: UM (User Management System), PO (Portal), PG (QPR Modeling Client) and SC.<model ID> (QPR Metrics)
objectTypeName: String. Defines the type of the new object. This needs to be a type name that is supported in the namespace. Also type ID can be used. See the UM Object Functions, SC Object Functions and PO Object Functions sections for a listing of valid type names. Using 0 here with the SC namespace creates the default measure type of element. For the PG namespace, the only supported type name is "model".
name: String. Defines name for the new object. In Portal context this is the same as Header. This option is not applicable for Alert objects.
parentIds: String. A comma-separated list of FullID's of parent objects. In the case this is empty and the namespace is PO, the Portal Discussion view is used as the parent. Not supported and must be empty for the PG namespace. For the SC namespace valid options depend on the type of the created object:
•Measure: If the FullID points at a scorecard, the top element of that scorecard is used as the parent element. Only one parent element is supported in this case.
•Scorecard: Maximum of one scorecard ID. In the case this is empty, the scorecard will be created under the root level of the model.
•SecondaryElement: If the FullID points at a scorecard, the top element of that scorecard is used as the parent element (only one parent element supported). Parent will be set as the owner of the secondary elements.
•Alert: If the FullID points at a scorecard, the alert will be created for the top element of that scorecard. Alerts can have only one parent element
•InformationItem: One or more measures or scorecards. References to a scorecard will be converted to point at the scorecard's top element.
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. Not supported and must be empty for the PG namespace.
options: String. A comma-separated list of options for creating the new object. Available options depend on the product and the object type. In addition, the following options are specifically supported by CreateObject:
•ClearParents: true | false. This attribute can be used to force the new object to be created without parent objects in the case the object type supports objects without parent objects. This option is not supported in the PG and SC namespaces.
•Series: FullID. When an alert is created (in the SC namespace), this option needs to be supplied and contain the ID of the series the alert is attached to.
•Folder. Only supported when creating a PG model. The target folder for the new model. If not given, root is used. Can be given as ID (12345), FullID (PG.12345) or as a folder path (\\draft models\BPMN)
•Template. Only supported when creating a PG model. The server template for creating the new model. Can be given as ID (12345), FullID (PG.12345) or as a folder path (\\templates\BPMNtemplate). Cannot be given at the same time as Basemodel.
•Basemodel. Only supported when creating a PG model. The base model for the new model. Can be given as ID (12345), FullID (PG.12345) or as a folder path (\\base models\BPMNbase). Cannot be given at the same time as Template.
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);
client.LogOff(sessionId);
client.Close();