0

Is there any way to "remove" an email address / subscriber from a list by AMPScript?

If yes, could you please provide the AMPScript?

I am NOT looking to change the subscriber status. I need to remove the subscriber from a specific list on a button click event on a microsite.

NOT looking for an API solution.

1
  • 1
    "Write this code for me" type questions aren't very popular around here. I'd suggest posting what code you've tried -- even if it doesn't work. – Adam Spriggs Feb 15 '17 at 17:21
3

You can use API AmpScript to delete the subscriber from a specific list. You just need to change the list id (i.e. 12345) and pass in the mentioned code.

%%[
SET @Subscriber=CreateObject("Subscriber")
    SetObjectProperty(@Subscriber,"SubscriberKey","test@gmail.com")
    SetObjectProperty(@Subscriber,"EmailAddress","test@gmail.com")

SET @list=CreateObject("SubscriberList")
    SetObjectProperty(@list,"ID","12345") 
    AddObjectArrayItem(@Subscriber,"Lists",@list)
SET @Status = InvokeDelete(@Subscriber,@status_msg,@Update_err) 
]%%

%%=v(@Status)=%%

Output: OK

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.