GetSharedEntitiesByAccountId Service Operation - Campaign Management

Gets the negative keyword lists from the account's library.

Request Elements

The GetSharedEntitiesByAccountIdRequest object defines the body and header elements of the service operation request. The elements must be in the same order as shown in the Request SOAP.

Request Body Elements

Element Description Data Type
SharedEntityType The type of shared entity to get from the account's library.

Currently the only supported value is NegativeKeywordList.

Request Header Elements

Element Description Data Type
AuthenticationToken The OAuth access token that represents a Microsoft Account user who has permissions to Bing Ads accounts. string
CustomerAccountId The identifier of the account that owns the entities in the request. This header element must have the same value as the AccountId body element when both are required. string
CustomerId The identifier of the customer that contains and owns the account. If you manage an account of another customer, you should use that customer ID instead of your own customer ID. string
DeveloperToken The developer token used to access the Bing Ads API. string
Password The Bing Ads managed user's sign-in password. string
UserName The Bing Ads managed user's sign-in name. You must not set this element to a Microsoft account or email address. string


The UserName and Password header elements are deprecated. In future versions of the API, Bing Ads will transition exclusively to Microsoft Account (email address) authentication. For more information, see Authentication with OAuth. UserName and Password are still required for Bing Ads managed credentials, but they are not applicable for Microsoft account authentication. To authenticate a Microsoft account, use the AuthenticationToken] header instead of UserName and Password.


The CustomerAccountId and CustomerId are required for most service operations, and as a best practice you should always specify them in the request.

Response Elements

The GetSharedEntitiesByAccountIdResponse object defines the body and header elements of the service operation response. The elements are returned in the same order as shown in the Response SOAP.

Response Body Elements

Element Description Data Type
SharedEntities The shared entities from the account's shared library, for example negative keyword lists. SharedEntity array

Response Header Elements

Element Description Data Type
TrackingId The identifier of the log entry that contains the details of the API call. string

Request SOAP

The following template shows the order of the body and header elements for the SOAP request.

<s:Envelope xmlns:i="" xmlns:s="">
  <s:Header xmlns="">
    <Action mustUnderstand="1">GetSharedEntitiesByAccountId</Action>
    <ApplicationToken i:nil="false">ValueHere</ApplicationToken>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <CustomerAccountId i:nil="false">ValueHere</CustomerAccountId>
    <CustomerId i:nil="false">ValueHere</CustomerId>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
    <Password i:nil="false">ValueHere</Password>
    <UserName i:nil="false">ValueHere</UserName>
    <GetSharedEntitiesByAccountIdRequest xmlns="">
      <SharedEntityType i:nil="false">ValueHere</SharedEntityType>

Response SOAP

The following template shows the order of the body and header elements for the SOAP response.

<s:Envelope xmlns:s="">
  <s:Header xmlns="">
    <TrackingId d3p1:nil="false" xmlns:d3p1="">ValueHere</TrackingId>
    <GetSharedEntitiesByAccountIdResponse xmlns="">
      <SharedEntities d4p1:nil="false" xmlns:d4p1="">
        <SharedEntity d4p1:type="-- derived type specified here with the appropriate prefix --">
          <AssociationCount d4p1:nil="false">ValueHere</AssociationCount>
          <ForwardCompatibilityMap xmlns:e254="" d4p1:nil="false">
              <e254:key d4p1:nil="false">ValueHere</e254:key>
              <e254:value d4p1:nil="false">ValueHere</e254:value>
          <Id d4p1:nil="false">ValueHere</Id>
          <Name d4p1:nil="false">ValueHere</Name>
          <Type d4p1:nil="false">ValueHere</Type>
          <!--This field is applicable if the derived type attribute is set to SharedList-->
          <ItemCount d4p1:nil="false">ValueHere</ItemCount>

Code Syntax

The example syntax can be used with Bing Ads SDKs. See Bing Ads Code Examples for more examples.

public async Task<GetSharedEntitiesByAccountIdResponse> GetSharedEntitiesByAccountIdAsync(
    string sharedEntityType)
    var request = new GetSharedEntitiesByAccountIdRequest
        SharedEntityType = sharedEntityType

    return (await CampaignManagementService.CallAsync((s, r) => s.GetSharedEntitiesByAccountIdAsync(r), request));
static GetSharedEntitiesByAccountIdResponse getSharedEntitiesByAccountId(
    java.lang.String sharedEntityType) throws RemoteException, Exception
    GetSharedEntitiesByAccountIdRequest request = new GetSharedEntitiesByAccountIdRequest();


    return CampaignManagementService.getService().getSharedEntitiesByAccountId(request);
static function GetSharedEntitiesByAccountId(

    $GLOBALS['Proxy'] = $GLOBALS['CampaignManagementProxy'];

    $request = new GetSharedEntitiesByAccountIdRequest();

    $request->SharedEntityType = $sharedEntityType;

    return $GLOBALS['CampaignManagementProxy']->GetService()->GetSharedEntitiesByAccountId($request);


Service: CampaignManagementService.svc v11