I created a one-click unsubscribe. But it is not unsubscribing any user.The user is still active in all subscriber list. I've used the below code
%%[
/* declare variables */
var @sid, @jid, @listid, @batchid, @reason, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @Response, @Status, @Error
/* import the personalization string values from the query string into the variables */
set @skey = AttributeValue("_subscriberkey")
set @jobid = AttributeValue("jobid")
set @listid = AttributeValue("listid")
set @batchid = AttributeValue("_JobSubscriberBatchID")
/* set the reason for the unsubscribe */
set @reason = "Custom Unsubscribe"
/* initiate the LogUnsubEvent request */
set @lue = CreateObject("ExecuteRequest")
SetObjectProperty(@lue, "Name", "LogUnsubEvent")
/* configure the properties of the API object */
set @lue_prop = CreateObject("APIProperty")
SetObjectProperty(@lue_prop, "Name", "SubscriberKey")
SetObjectProperty(@lue_prop, "Value", @skey)
AddObjectArrayItem(@lue, "Parameters", @lue_prop)
set @lue_prop = CreateObject("APIProperty")
SetObjectProperty(@lue_prop, "Name", "JobID")
SetObjectProperty(@lue_prop, "Value", @jobid)
AddObjectArrayItem(@lue, "Parameters", @lue_prop)
set @lue_prop = CreateObject("APIProperty")
SetObjectProperty(@lue_prop, "Name", "ListID")
SetObjectProperty(@lue_prop, "Value", @listid)
AddObjectArrayItem(@lue, "Parameters", @lue_prop)
set @lue_prop = CreateObject("APIProperty")
SetObjectProperty(@lue_prop, "Name", "BatchID")
SetObjectProperty(@lue_prop, "Value", @batchid)
AddObjectArrayItem(@lue, "Parameters", @lue_prop)
set @lue_prop = CreateObject("APIProperty")
SetObjectProperty(@lue_prop, "Name", "Reason")
SetObjectProperty(@lue_prop, "Value", @reason)
AddObjectArrayItem(@lue, "Parameters", @lue_prop)
/* you have to set the ClientID only when working with On Your Behalf accounts
var @mid, @lue_oyb
set @mid = memberid
set @lue_oyb = CreateObject('ClientID')
SetObjectProperty(@lue_oyb, 'ID', @mid)
SetObjectProperty(@lue, 'Client', @lue_oyb)
*/
/* this is where the unsubscribe is performed */
set @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)
/*
set @Response = Row(@lue_statusCode, 1)
set @Status = Field(@Response, "StatusMessage")
set @Error = Field(@Response, "ErrorCode")
IF (@Error == "12012") OR (@Error == "401") OR (@Status == "Event posted") THEN
/* it worked */
ELSE
*/
/* it failed, do a normal update */
SET @sub = CreateObject("Subscriber")
SetObjectProperty(@sub, "SubscriberKey", @skey)
SET @list = CreateObject("SubscriberList")
SetObjectProperty(@list, "Status", "Unsubscribed")
SetObjectProperty(@list, "ID", @listid)
SetObjectProperty(@list, "Action", "Update")
AddObjectArrayItem(@sub, "Lists", @list)
SET @statusCode = InvokeUpdate(@sub, @statusMsg, @errorCode)
ENDIF
]%%