Click or drag to resize
RallyRestApiAddToCollection Method
Add items to a collection

Namespace: Rally.RestApi
Assembly: Rally.RestApi (in Rally.RestApi.dll) Version: 3.1.1.0 (3.1.1.0)
Syntax
public OperationResult AddToCollection(
	string itemRef,
	string collectionName,
	List<DynamicJsonObject> items,
	NameValueCollection parameters
)

Parameters

itemRef
Type: SystemString
The ref of the object to update e.g. /defect/12345
collectionName
Type: SystemString
The name of the collection to be updated e.g. Tasks
items
Type: System.Collections.GenericListDynamicJsonObject
The items to add. These can be references to existing objects or new objects to be created.
parameters
Type: System.Collections.SpecializedNameValueCollection
additional query string parameters to be included on the request

Return Value

Type: OperationResult
An OperationResult describing the status of the request
Examples
C#
DynamicJsonObject existingTask = new DynamicJsonObject(); 
existingTask["_ref"] = "/task/23456";
DynamicJsonObject newTask = new DynamicJsonObject();
newTask["Name"] = "New Task";
NameValueCollection parameters = new NameValueCollection();
parameters["fetch"] = "FormattedID";
List{DynamicJsonObject} newItems = new List{DynamicJsonObject}() { existingTask, newTask };
OperationResult updateResult = restApi.AddToCollection("/defect/12345", "Tasks", newTasks, parameters);
See Also