Can you move Automation Studio activities to different folders programmatically

automationstudiomarketing-cloudssjs

I am currently trying to programmatically sort out Automation Studio activities (e.g. Email, SQL Query, Filter, and Script activities) into designated folders. I have started with Filters, based on the related SOAP object, there are some fields that are retrievable yet there is no "CategoryID" field available as SQL Query activity has. So here is what I did to reassure:

<script language="javascript" runat="server">
    Platform.Load("Core", "1");
    var prox = new Script.Util.WSProxy();

    var cols = [
        /*"FilterActivityID"*/
        /*,"FilterDefinitionID"*/
        "DestinationObjectID"
        ,"DestinationTypeID"
        ,"SourceObjectID"
        ,"SourceTypeID"
        /*,"OwnerID"*/
        ,"StatusID"
        /*,"CreatedBy"*/
        /*,"ModifiedBy"*/
        /*,"InteractionObjectID"*/
        ,"Name"
        ,"Description"
        /*,"Keyword"*/
        /*,"Client"*/
        /*,"PartnerKey"*/
        /*,"PartnerProperties"*/
        ,"CreatedDate"
        ,"ModifiedDate"
        ,"ObjectID"
        ,"CustomerKey"
        /*,"Owner"*/
        /*,"CorrelationID"*/
        /*,"ObjectState"*/
        /*,"IsPlatformObject"*/
    ];
    var filter = {Property: "CustomerKey", SimpleOperator: "equals", Value: "xxxx"};
    var data = prox.retrieve("FilterActivity", cols, filter);
    Write(Stringify(data));
</script>

Commented out columns turned out to be non-retrievable even though some of them actually should be retrievable based on the documentation.
On another side, it is also possible to retrieve on the Folder to which I want to move the activities and see its "ContentType":"filteractivity" and "FolderID" values to use them later on for moving the activity but it seems we are limited on parameters that could be updated for the activity.

Hence, my question – am I missing something, and generally is there a possible way of moving Automation Studio activities into folders programmatically?

Best Answer

FilterActivity objects don't have an exposed CategoryID property, so you can't move them. It does seem like they do in older accounts -- since the Filter Activities are still listed under Interactions in Email Studio.

One little trick for finding retrievable SOAP properties -- find your BU's tenant ID, and browse to the WSDL URL and hit CTRL-E to view the source of the page. Search for the object and review the IsRetrievable properties.

Related Topic