Change Campaign Status [OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]]

5 views
Skip to first unread message

Michael D

unread,
Apr 15, 2015, 9:12:12 AM4/15/15
to adwor...@googlegroups.com
Hi,

Im trying to Change CampaignStatus. But I get the Error:
 [OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]]

Does anyone know what Im doing wrong here?

            var client = new CampaignService.CampaignService();

           
//create Campaign with Status
           
Campaign campaign = new Campaign();
            campaign
.id = CurrentCampaignId;
            campaign
.idSpecified = true;

           
switch (index)
           
{
               
case 0:
                    campaign
.status=CampaignStatus.ENABLED;
                   
break;
               
case 1:
                    campaign
.status=CampaignStatus.PAUSED;
                   
break;
               
case 2:
                    campaign
.status=CampaignStatus.REMOVED;
                   
break;
           
}

           
//Create the Operation
           
CampaignOperation operation = new CampaignOperation();
            operation
.operand = campaign;
            operation
.@operator= Operator.REMOVE;
            operation
.operatorSpecified = true;        
           
           
try
           
{
                client
.PreAuthenticate = true;
                client
.UseDefaultCredentials = true;
                client
.RequestHeader = new SoapHeader
               
{
                    clientCustomerId
= AdWordsIdManagement.IdManagement.clientCustomerId,
                    developerToken
= "XXXXXXXXXXXXXXXXXXXXXX",
                    partialFailure
= false,
                    userAgent
= "AdWordsChangeStatus",
                    validateOnly
= false,
               
};
                client
.PreAuthenticate = true;

               
CampaignReturnValue returnValue = client.mutate(new CampaignOperation[] {operation});

               
if (returnValue != null && returnValue.value != null && returnValue.value.Length > 0)
               
{
                   
Campaign changedCampaign = returnValue.value[0];
               
}
               
else
               
{
                   
Console.WriteLine("No status has changed");
               
}

           
}
           
catch (Exception ex)
           
{
               
throw new System.ApplicationException("Failed to change status", ex);
           
}  

Thank you ;)
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages