|
|
Documentation Wiki > ExactTarget > Content > Server-Side JavaScript > Server-Side JavaScript Syntax Guide > Folder Server-Side JavaScript Functions
Folder Server-Side JavaScript FunctionsFrom $1Table of contents
(Click the banner to go to the related Docs.Code.ExactTarget.com page.) This document contains conceptual, procedural, and scenario information regarding the use of the Folder server-side JavaScript functions. Why Use the Folder Server-Side JavaScript FunctionsThese functions allow you to access and control folders within your ExactTarget account. ScenarioNorthern Trail Outfitters uses folders to organize their email messages. Server-side JavaScript allows them to create new folders and name them according to the month the emails inside the folders were sent. They can then retrieve those folders at a later date based on the name of the folder. How to Use the Folder Server-side JavaScript FunctionsIn your server-side JavaScript code, first load the core library using the syntax below: Platform.Load("core","1");
Use the sample code below as models to construct your own server-side JavaScript code. InitializeTo interact with a folder via server-side JavaScript, you must first initialize the object. The code below initializes a folder with the external key of myFolder. var myFolder = Folder.Init("myFolder");
Note that not all Folder objects will have an external key. You can initialize a Folder by assigning it an ID number, as shown in the sample code below: var myIDFolder = Folder.Init(); myIDFolder.SetID(12345); Once you initialize the folder, use the ID number to identify the folder in place of the external key for all functions listed on this page. Add(folder)This function adds a new folder to your account as a child to a previously existing folder and returns the status. Arguments
The sample code below adds a folder to your account: var newFolder = {
"Name" : "Test Add Folder",
"CustomerKey" : "test_folder_key",
"Description" : "Test added",
"ContentType" : "email",
"IsActive" : "true",
"IsEditable" : "true",
"AllowChildren" : "false",
"ParentFolderID" : 123456
};
var status = Folder.Add(newFolder);
Remove()This function removes a previously initialized folder. The sample code below deletes the folder with the external key myFolder: var myFolder = Folder.Init("myFolder");
myFolder.Remove();
Retrieve(filter)This function retrieves an array of folders based on the specified criteria. You will also retrieve details regarding the parent folder of a given folder if one exists. Arguments
The sample code below retrieves an array of folders based on the specified criteria: var results = Folder.Retrieve({Property:"Name",SimpleOperator:"equals",Value:"my emails"});
Update(attributes)This function updates the folder and returns a status. Arguments
The sample code below updates the Name attribute of the folder to the specified value: var myFolder = Folder.Init("myFolder");
var status = myFolder.Update({ "Name" : "Updated Folder Name" });
This page was last updated by Ryan Williams on Tue, 17 Jan 2012 16:59:47 GMT. If you require assistance with the ExactTarget application, please contact Global Support. If you wish to send Ryan direct feedback, fill out the form below:
Tags: (Edit tags)
|
Powered by MindTouch 2010 |