1

如何获得 AdgroupCriterion 的运算符(添加/删除/设置)?

    MutateJobService mutateJobService = (MutateJobService)user.GetService(AdWordsService.v201309.MutateJobService);
    JobResult jobResult = mutateJobService.getResult(new BulkMutateJobSelector { includeStats = true, jobIds = jobIDs });
    SimpleMutateResult results = (SimpleMutateResult)jobResult.Item;

    if (results.results != null)
    {
        for (int i = 0; i < results.results.Length; i++)
        {
            Operand operand = results.results[i];
            var operandType = operand.Item.GetType();
            if (operandType.BaseType.Name == "AdGroupCriterion")
            {
                AdGroupCriterion adGroupCriterion = (AdGroupCriterion)operand.Item;
                // how to get operator (add/remove/set)?
            }
        }
    }

这是我创建操作的方式:

public static AdGroupCriterionOperation GetAdgroupNegativeKeywordOperation(Keyword keyword, long adgroupID, Google.Api.Ads.AdWords.v201309.Operator operat)
{

    NegativeAdGroupCriterion criterion = new NegativeAdGroupCriterion
    {
        adGroupId = adgroupID,
        criterion = keyword
    };
    AdGroupCriterionOperation operation = new AdGroupCriterionOperation
    {
        @operator = operat,
        operand = criterion
    };

    return operation;
}
4

1 回答 1

1

目前,正如我所见,解决它的唯一方法是在创建作业时存储操作,并在获得结果时将其与索引匹配。

(@JeremyAube 对Google Adwords API 的评论:在 APIError 上获取标准信息让我得出了这个结论。)

于 2013-11-11T21:20:55.713 回答