This function adds an object to a Marketing Cloud API Object array.



Ordinal Type Required Description
1 API Object True The API Object that contains the array
2 String True The array property associated with the item to be added
3 String True The item to add to the array


The following example retrieves all of the DataFolder objects in a Marketing Cloud account. The AddObjectArrayItem() lines are used to add the object attributes to retrieve in the request (ID and Name).


var @rr, @ID, @Name
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "DataFolder")
AddObjectArrayItem(@rr, "Properties", "ID")
AddObjectArrayItem(@rr, "Properties", "Name")

set @dataFolders = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

output(concat("rrStatus: ", @rrStatus))
output(concat("<br>rrRequestID: ", @rrRequestID))

for @i = 1 to RowCount(@dataFolders) do

  set @dataFolder = Row(@dataFolders, @i)
  set @ID = Field(@dataFolder, "ID")
  set @Name = Field(@dataFolder, "Name")

  output(concat("<br>ID: ", @ID, ", Name: ", @Name))

next @i



rrStatus: OK
rrRequestID: 9a64813a-0aa1-497b-8cb6-c6030531b3b1
ID: 13738, Name: my emails
ID: 13739, Name: simple automated emails
ID: 13740, Name: my templates
ID: 13741, Name: my lists
ID: 13742, Name: my tracking
ID: 13743, Name: my contents
ID: 13744, Name: my documents
ID: 13745, Name: my surveys
ID: 13746, Name: my images
ID: 13747, Name: Portfolio
ID: 13748, Name: my groups
ID: 13749, Name: my subscribers
ID: 13750, Name: Forward to a Friend
ID: 13751, Name: Forward to a Friend
ID: 13752, Name: Suppression Lists
ID: 13753, Name: Triggered Sends
ID: 13754, Name: User-Initiated
ID: 13755, Name: Data Extensions
ID: 13756, Name: Publication Lists
ID: 13757, Name: my microsites
ID: 13758, Name: microsite layouts
ID: 13760, Name: Query
ID: 13761, Name: Data Filters
ID: 13762, Name: Filter
ID: 13763, Name: Social
ID: 13764, Name: A/B Testing
ID: 13765, Name: my workflows
ID: 25111, Name: Journey Builder Sends
ID: 58137, Name: HiddenCategory
ID: 58138, Name: SystemHiddenDataFilters
ID: 58139, Name: SystemHiddenDataFiltersForGE
ID: 58140, Name: SystemHiddenFilterActivities
ID: 58141, Name: SystemHiddenFilterActivitiesForGE
ID: 58142, Name: my automations
ID: 58547, Name: Salesforce Single Sends
ID: 58548, Name: Salesforce Mass Sends
ID: 58549, Name: Salesforce Sends
ID: 58550, Name: Salesforce Data Extensions