I see that you must first add a budget before you can add a campaign (as 
per the C# sample code v201209). That works ok. However, I can't seem to 
delete a budget once I've added it. 
 
I just created a budget in my sandbox just before creating a campaign (a la 
AdCampaign.cs). This budget is attached to this campaign only. I deleted 
the campaign, and then tried to delete the budget. I don't get an error on 
the mutate operation, but it doesn't delete the budget either. The deleted 
budget status always comes back ACTIVE. 
 
I use code similar to that from which I deleted the campaign. This budget 
is attached only to this one campaign. If the campaign is deleted, how is 
it possible for the budget to still be ACTIVE and IN_USE?...
 

public void DeleteBudget(AdWordsUser user, int budgetID)
{
    Console.WriteLine("Delete budget entered...");
    BudgetService bs = (BudgetService)user
        .GetService(AdWordsService.v201209.BudgetService);
    Budget budget = new Budget();
    budget.budgetId = budgetID;
    budget.status = BudgetBudgetStatus.DELETED;        
    BudgetOperation bop = new BudgetOperation();
    bop.operand = budget;
    bop.@operator = Operator.SET; //Operator.REMOVE gives an error
    BudgetOperation[] bops = new BudgetOperation[1];
    bops[0] = bop;
    try
    {
        BudgetReturnValue retVal =
            bs.mutate(bops);
        Budget deletedBudget = retVal.value[0];
        Console.WriteLine(deletedBudget.status); //always comes back ACTIVE
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
        if (ex.InnerException != null)
        {
            Console.WriteLine(ex.InnerException.Message);
        }
    }
}

 

...btw, I tried the Operator.REMOVE which gives me an error saying it is in use.

 

Thanks,

 

Eric

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to