0

I am trying to create a new email using FuelSDK php.

It create email successfully and return correct ID for that, but it always created in top folder i:e "My Emails" whereas I am passing CategoryID => "????".

I have seen some examples in help where CategoryID passed as Integer e:g "CategoryID" => 1234, how I can get the ID of the folder to pass in my code ? because when I see properties of folder I see only Name, Owner, Created and Last Modified values and there is no key or id.

$postEmail->props = array("CustomerKey" => $NameOfEmail, "Name"=>$NameOfEmail, "Subject"=>$SubjectOfEmail,  "HTMLBody"=> $returned_content,  "EmailType" => "HTML", "IsHTMLPaste" => "true", "CategoryID" => "MyNewFolder");

Regards,

1 Answer 1

0

The only way you can get Folder Id (Integer) is using API.

$FolderName = "MyFolder";
$FolderID = 0; //initialize to avoid null value
$getFolder = new ET_Folder();
$getFolder->authStub = $myclient;
$getFolder->filter = array('Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => $FolderName);
$getFolder->props = array("ID");
$getResponse = $getFolder->get();
if (($getResponse->status=='true') && (count($getResponse->results) > 0) ){

    $FolderID = $getResponse->results[0]->ID;
}

Then you can use this Id for creating email, so email land in this particular folder.

Same way you can provide folder id if you want to create a folder within this folder.

1
  • The Folder ID is exposed in the Web UI as well - if you hover over any folder in the sidebar, the preview of the link target (at the bottom of your browser window) specifies the CategoryID.
    – c4collins
    Commented Jun 16, 2017 at 13:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .