private static void createSiteLinksCampaignFeed(AdWordsUser user,
      SiteLinksDataHolder siteLinksData, long campaignId)
        {
            // Get the CampaignFeedService.
              CampaignFeedService campaignFeedService =
            (CampaignFeedService) user.GetService(AdWordsService.v201306.CampaignFeedService);

              // Map the feed item ids to the campaign using an IN operation.
              RequestContextOperand feedItemRequestContextOperand = new RequestContextOperand();
              feedItemRequestContextOperand.contextType = RequestContextOperandContextType.FEED_ITEM_ID;

              List<FunctionArgumentOperand> feedItemOperands = new List<FunctionArgumentOperand>();
              foreach (long feedItemId in siteLinksData.SiteLinkFeedItemIds) {
            ConstantOperand feedItemOperand = new ConstantOperand();
            feedItemOperand.longValue = feedItemId;
            feedItemOperand.type = ConstantOperandConstantType.LONG;
            feedItemOperands.Add(feedItemOperand);
              }

              Function feedItemfunction = new Function();
              feedItemfunction.lhsOperand = new FunctionArgumentOperand[] {feedItemRequestContextOperand};
              feedItemfunction.@operator = FunctionOperator.IN;
              feedItemfunction.rhsOperand = feedItemOperands.ToArray();

              // Optional: to target to a platform, define a function and 'AND' it with
              // the feed item ID link:
              RequestContextOperand platformRequestContextOperand = new RequestContextOperand();
              platformRequestContextOperand.contextType = RequestContextOperandContextType.DEVICE_PLATFORM;

              ConstantOperand platformOperand = new ConstantOperand();
              platformOperand.stringValue = "Mobile";
              platformOperand.type = ConstantOperandConstantType.STRING;

              Function platformFunction = new Function();
              platformFunction.lhsOperand = new FunctionArgumentOperand[] {platformRequestContextOperand};
              platformFunction.@operator = FunctionOperator.EQUALS;
              platformFunction.rhsOperand = new FunctionArgumentOperand[] {platformOperand};

              // Combine the two functions using an AND operation.
              FunctionOperand feedItemFunctionOperand = new FunctionOperand();
              feedItemFunctionOperand.value = feedItemfunction;

              FunctionOperand platformFunctionOperand = new FunctionOperand();
              platformFunctionOperand.value = platformFunction;

              Function combinedFunction = new Function();
              combinedFunction.@operator = FunctionOperator.AND;
              combinedFunction.lhsOperand = new FunctionArgumentOperand[] {
              feedItemFunctionOperand, platformFunctionOperand};

              CampaignFeed campaignFeed = new CampaignFeed();
              campaignFeed.feedId = siteLinksData.SiteLinksFeedId;
              campaignFeed.campaignId = campaignId;
              campaignFeed.matchingFunction = combinedFunction;
              // Specifying placeholder types on the CampaignFeed allows the same feed
              // to be used for different placeholders in different Campaigns.
              campaignFeed.placeholderTypes = new int[] {PLACEHOLDER_SITELINKS};

              CampaignFeedOperation operation = new CampaignFeedOperation();
              operation.operand = campaignFeed;
              operation.@operator = Operator.ADD;
              CampaignFeedReturnValue result =
              campaignFeedService.mutate(new CampaignFeedOperation[] {operation});
              foreach (CampaignFeed savedCampaignFeed in result.value) {
            Console.WriteLine("Campaign with ID {0} was associated with feed with ID {1}",
            savedCampaignFeed.campaignId, savedCampaignFeed.feedId);
              }
        }
        /// <summary>
        /// Associates the sitelink feed items with a campaign.
        /// </summary>
        /// <param name="campaignFeedService">The campaign feed service.</param>
        /// <param name="siteLinksFeed">The feed for holding the sitelinks.</param>
        /// <param name="siteLinkFeedItemIds">The list of feed item ids to be
        /// associated with a campaign as sitelinks.</param>
        /// <param name="campaignId">The campaign id to which upgraded sitelinks are
        /// added.</param>
        private static void associateSitelinkFeedItemsWithCampaign(
        CampaignFeedService campaignFeedService, SiteLinksFeed siteLinksFeed,
        List<long> siteLinkFeedItemIds, long campaignId)
        {
            // Create a custom matching function that matches the given feed items to
              // the campaign.
              RequestContextOperand requestContextOperand = new RequestContextOperand();
              requestContextOperand.contextType = RequestContextOperandContextType.FEED_ITEM_ID;

              Function function = new Function();
              function.lhsOperand = new FunctionArgumentOperand[] {requestContextOperand};
              function.@operator = FunctionOperator.IN;

              List<FunctionArgumentOperand> operands = new List<FunctionArgumentOperand>();
              foreach (long feedItemId in siteLinkFeedItemIds) {
            ConstantOperand constantOperand = new ConstantOperand();
            constantOperand.longValue = feedItemId;
            constantOperand.type = ConstantOperandConstantType.LONG;
            operands.Add(constantOperand);
              }
              function.rhsOperand = operands.ToArray();

              // Create upgraded sitelinks for the campaign. Use the sitelinks feed we
              // created, and restrict feed items by matching function.
              CampaignFeed campaignFeed = new CampaignFeed();
              campaignFeed.feedId = siteLinksFeed.SiteLinksFeedId;
              campaignFeed.campaignId = campaignId;
              campaignFeed.matchingFunction = function;
              campaignFeed.placeholderTypes = new int[] {PLACEHOLDER_SITELINKS};

              CampaignFeedOperation operation = new CampaignFeedOperation();
              operation.operand = campaignFeed;
              operation.@operator = Operator.ADD;
              campaignFeedService.mutate(new CampaignFeedOperation[] {operation});
        }