Submit an Ad Group for Approval in C#

The following example shows how to submit an ad group for editorial approval using the Campaign Management SubmitAdGroupForApproval service operation.

This example has been developed and run within the environment described in Getting Started Using C# and Visual Basic with Bing Ads Services.

System_CLiX_note Note

This example uses the UserName and Password elements for authentication. For Managing User Authentication with OAuth, replace the UserName and Password elements with the AuthenticationToken, which is your OAuth access token.

static void SubmitAdGroup(
    CampaignManagementServiceClient service,
    string username,
    string password,
    string appToken,
    string devToken,
    long customerAccountId,
    long customerId,
    long adGroupId)
    SubmitAdGroupForApprovalRequest request = 
        new SubmitAdGroupForApprovalRequest();

    // Set the request header information.
    request.ApplicationToken = appToken;
    request.CustomerAccountId = customerAccountId.ToString();
    request.CustomerId = customerId.ToString();
    request.DeveloperToken = devToken;
    request.UserName = username;
    request.Password = password;

    // Set the ad group identifier.
    request.AdGroupId = adGroupId;

        SubmitAdGroupForApprovalResponse response = 

    // Exception handling.

    // Capture any generic errors.
    catch (FaultException<AdApiFaultDetail> adApiFault)
        // Get the AdApiFaultDetail object.
        AdApiFaultDetail detail = adApiFault.Detail;
        foreach (AdApiError error in detail.Errors)
            Console.Write("Ad API error");
            Console.WriteLine(" '{0}' ({1}) encountered.",

    // Capture any service operation exceptions.
    catch (FaultException<ApiFaultDetail> apiFault)
        ApiFaultDetail detail = apiFault.Detail;

        // Display service operation error information.
        foreach (OperationError opError in detail.OperationErrors)
            Console.Write("Operation error");
            Console.WriteLine(" '{0}' ({1}) encountered.",


Community Additions