I want to retrieve all emails with AMPScript, but I can't do that.

I tried to show all emails on my landing page, but I couldn't find a way to access Email.

I tried this code:

SET @r = CreateObject("RetrieveRequest")
SetObjectProperty(@r, "ObjectType", "Email")

It seem to work, however, I don't know how to go on.

Who can show me an example? Thanks a lot!

1 Answer 1


Take a look at the InvokeRetrieve example on this wiki page and substitute 'List' with 'Email'. Here's a quick example:

SET @rr = CreateObject("RetrieveRequest")  
SetObjectProperty(@rr, "ObjectType", "Email")  
SET @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "Type")  
SetObjectProperty(@sfp, "SimpleOperator", "equals")  
AddObjectArrayItem(@sfp, "Value", "Public")    
SetObjectProperty(@rr, "Filter", @sfp) 
SET @rows = InvokeRetrieve(@rr)  

FOR @i = 1 to RowCount(@rows) DO    
    SET @row = Row(@rows ,@i)   
    SET @emailName = Field(@row ,'Name')   
    SET @emailSubject = Field(@row ,'Subject')
    outputline(concat("<br>EmailName:", @emailName))   
    outputline(concat("<br>EmailSubject:", @emailSubject))   

If you're wanting to use the AMPScript API functions, it's good to know about the the SFMC API Objects. I often refer to the SOAP envelope examples for structuring the API calls:


  • Thanks for your answers, Adam. I`ve studied the AMPscript for a week so your answers are very important to understand this language for me, thanks again!
    – Leisure
    Aug 13, 2015 at 3:09

You must log in to answer this question.

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