Skip to content

Instantly share code, notes, and snippets.

@samteezy
Last active August 7, 2018 15:05
Show Gist options
  • Select an option

  • Save samteezy/b507dd8859558aa5e3690f3b8d8bfb6f to your computer and use it in GitHub Desktop.

Select an option

Save samteezy/b507dd8859558aa5e3690f3b8d8bfb6f to your computer and use it in GitHub Desktop.
Marketing Cloud: Survey All Lists and DEs
<script runat="server">
Platform.Load("Core","1");
try {
var prox = new Script.Util.WSProxy();
var queryAllAccounts = true;
/* Retrieve All List Info */
var objectType = "List";
var cols = ["ListName","AutomatedEmail.ID","Category","Client.ID","CreatedDate","CustomerKey","Description","ID","ListClassification","ListName","ModifiedDate","ObjectID","Client.PartnerClientKey","Type"];
var filter = {
Property: "ListName",
SimpleOperator: "notEquals",
Value: "All Subscribers"
};
var listdata = prox.retrieve(objectType, cols, filter, queryAllAccounts);
Variable.SetValue("@Lists",Stringify(listdata));
/* Retrieve All DE Info */
var objectType = "DataExtension";
var cols = ["Name","CategoryId","Client.ID","CreatedDate","CustomerKey","Description","IsSendable","CustomerKey","ModifiedDate","ObjectID","PartnerKey","Status"];
var filter = {
Property: "Name",
SimpleOperator: "like",
Value: "%"
};
var dedata = prox.retrieve(objectType, cols, filter, queryAllAccounts);
Variable.SetValue("@DEs",Stringify(dedata));
} catch (ex) {
Write("An error has occurred: " + Stringify(ex));
}
</script>
<p>
Convert JSON to CSV by using <a href="https://konklone.io/json/">this tool</a> or a similar site.
</p>
Lists:
<br />
<br />
%%=v(@Lists)=%%
<br />
<hr>
<br />
Data Extensions:
<br />
<br />
%%=v(@DEs)=%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment