[SalesForce] Unsubscribe an user from a list using the SOAP API

We want to unsubscribe a user from a list using the SOAP API. Deleting the user works, but setting the status unsubscribed does not.

here is what we tried:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
  <ns1:fueloauth xmlns:ns1="http://exacttarget.com">{{token}}</ns1:fueloauth>
</soapenv:Header>
<soapenv:Body>
    <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <Objects xsi:type="Subscriber">
             <EmailAddress>xxx@gmails.com</EmailAddress>
             <SubscriberKey>xxx@gmails.com</SubscriberKey>  
             <Lists>
                <ID>42</ID>
                <Action>Unsubscribed</Action>
             </Lists>
        </Objects>
    </UpdateRequest>
</soapenv:Body>
</soapenv:Envelope>

Is it simply changing the action or is there more involved? Cant really find it in the docs.

Best Answer

Please try adding SaveOptions with SaveAction of 'UpdateAdd' and PropertyName of * (star)

See link [http://help.exacttarget.com/en/technical_library/web_service_guide/technical_articles/updating_an_existing_subscriber_using_the_create_method_with_updateadd/][1]

Try this & let us know if this works.

So sample SOAP

<soapenv:Body>
    <Options>  
                <SaveOptions>  
                    <SaveOption>  
                        <PropertyName>*</PropertyName>  
                        <SaveAction>UpdateAdd</SaveAction>  
                    </SaveOption>  
                </SaveOptions>  
            </Options>  
    <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <Objects xsi:type="Subscriber">
             <EmailAddress>xxx@gmails.com</EmailAddress>
             <SubscriberKey>xxx@gmails.com</SubscriberKey>  
             <Lists>
                <ID>42</ID>
                <Action>Unsubscribed</Action>
             </Lists>
        </Objects>
    </UpdateRequest>
</soapenv:Body>
Related Topic