Depending on your BU configuration, you may find it easier to change All Subscribers status, which will flow to any Publication Lists. If that's not what you need, then SSJS and WSProxy will help you here. Specifically, using the Impersonation feature. This will probably work in a CloudPage, but might be better in a Script Activity in an Automation depending on the number of publication lists you are altering.
<script runat="server">
Platform.Load("core","1.1.5");
var prox = new Script.Util.WSProxy();
var options = {SaveOptions: [{'PropertyName': '*', SaveAction: 'UpdateAdd'}]};
var email = '[email protected]';
var subscriberkey = 'yourkey';
function unsub(obj) {
prox.setClientId({ "ID": obj.mid }); //This will switch BU contexts
var props = {
SubscriberKey: subscriberkey,
EmailAddress: email,
Lists: [{
ID: obj.listID,
Status: 'Unsubscribed'
}]
};
var data = prox.updateItem("Subscriber", props, options);
prox.resetClientIds(); //This will reset BU context
return data.Results[0].StatusCode;
}
var myPubLists = [
{mid:'123456', listID:'123'},
{mid:'123456', listID:'456'},
{mid:'654321', listID:'789'}
];
for (var i=0; i<myPubLists.length; i++) {
var result = unsub(myPubLists[i]);
Write("<br>Result:" + result);
}
</script>
Gathering the List IDs can be painful. If you don't already have a list, they can be retrieved with WSProxy also. You could combine with the above if you didn't have a static list of publists.
<script runat="server">
Platform.Load("core","1.1.5");
var prox = new Script.Util.WSProxy();
var queryAllAccounts = true;
var cols = ["Client.ID","CustomerKey","ListName","ID"];
var filter = {
Property: "ListClassification",
SimpleOperator: "equals",
Value: "PublicationList"
};
var publists = prox.retrieve("List", cols, filter, queryAllAccounts);
Write(Stringify(publists));
</script>