Marketing Cloud Engagement has a new model for storing, finding, managing, creating, sharing, and distributing all content-related objects. Access the objects created with the new Content Builder tools using the REST API. Your existing SOAP API integrations only function with the Classic tools.
This page contains information regarding retrieving an object from your account’s Portfolio.
Why Retrieve an Item from Your Portfolio
You can use the Retrieve method to find out more information about and use those items in email sends and other activities.
How to Retrieve an Item from Your Portfolio
Use the sample code below as a model for your own API call.
Sample .NET Code
1private void RetrievePortfolio()2{3SoapClient framework = new SoapClient();4framework.ClientCredentials.UserName.UserName = "xxx";5framework.ClientCredentials.UserName.Password = "xxx";6String requestID;7String status;8SimpleFilterPart sfp = new SimpleFilterPart();9sfp.Property = "CustomerKey";10sfp.SimpleOperator = SimpleOperators.equals;11sfp.Value = new string[]{"Parka Guy"};12RetrieveRequest rr = new RetrieveRequest();13rr.ObjectType = "Portfolio";14rr.Properties = new string[]{"FileURL", "CustomerKey", "FileName", "IsUploaded"};15rr.Filter = sfp;16APIObject[]results;17status = framework.Retrieve(rr, out requestID, out results);18Console.WriteLine(status);19if(status.ToUpper() == "OK")20{21foreach(Portfolio p in results)22{23Console.WriteLine("FileName: " + p.FileName);24Console.WriteLine("IsUploaded: " + p.IsUploaded);25Console.WriteLine("FileURL: " + p.FileURL);26}27}28}
Sample Java Code (Axis 1.4)
1public void testFileDetails(){2 try{3 Soap stub = init();4 RetrieveRequest retrieveRequest = new RetrieveRequest();5 retrieveRequest.setObjectType("Portfolio");6 String[]stringArray = {"FileName", "IsUploaded", "FileURL"};7 retrieveRequest.setProperties(stringArray);8 RetrieveRequestMsg retrieveRequestMsg = new RetrieveRequestMsg();9 retrieveRequestMsg.setRetrieveRequest(retrieveRequest);10 retrieveRequest.setQueryAllAccounts(true);11 SimpleFilterPart filter = new SimpleFilterPart();12 filter.setProperty("FileName");13 filter.setSimpleOperator(SimpleOperators.equals);14 java.util.List filterValues = new ArrayList();15 filterValues.add(new String("Test1.jpg"));16 filter.setValue((String[])filterValues.toArray(new String[filterValues.size()]));17 retrieveRequest.setFilter(filter);18 RetrieveResponseMsg retrieveResponseMsg = stub.retrieve(retrieveRequestMsg);19 System.out.println("[overall status message] " + retrieveResponseMsg.getOverallStatus());20 APIObject[]apiObjectList = retrieveResponseMsg.getResults();21 List<APIObject>list1 =Arrays.asList(apiObjectList);22 Iterator it = list1.iterator();23 while(it.hasNext()){24 Portfolio o = (Portfolio)it.next();25 System.out.println("FileLocation ::: " + o.getFileName());26}27}catch(RemoteException e){28 e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.29}