Google.Api.Ads.AdWords.Examples.CSharp.v201306.UpgradeLegacySitelinks.newSiteLinkFeedItemAddOperation C# (CSharp) Method

newSiteLinkFeedItemAddOperation() private static method

Creates a new operation for adding a feed item.
private static newSiteLinkFeedItemAddOperation ( SiteLinksFeed siteLinksFeed, string text, string url ) : FeedItemOperation
siteLinksFeed SiteLinksFeed The site links feed.
text string The sitelinks text.
url string The sitelinks URL.
return Google.Api.Ads.AdWords.v201306.FeedItemOperation
        private static FeedItemOperation newSiteLinkFeedItemAddOperation(
        SiteLinksFeed siteLinksFeed, string text, string url)
        {
            // Create the FeedItemAttributeValues for our text values.
              FeedItemAttributeValue linkTextAttributeValue = new FeedItemAttributeValue();
              linkTextAttributeValue.feedAttributeId = siteLinksFeed.LinkTextFeedAttributeId;
              linkTextAttributeValue.stringValue = text;
              FeedItemAttributeValue linkUrlAttributeValue = new FeedItemAttributeValue();
              linkUrlAttributeValue.feedAttributeId = siteLinksFeed.LinkUrlFeedAttributeId;
              linkUrlAttributeValue.stringValue = url;

              // Create the feed item and operation.
              FeedItem item = new FeedItem();
              item.feedId = siteLinksFeed.SiteLinksFeedId;
              item.attributeValues =
              new FeedItemAttributeValue[] {linkTextAttributeValue, linkUrlAttributeValue};
              FeedItemOperation operation = new FeedItemOperation();
              operation.operand = item;
              operation.@operator = Operator.ADD;
              return operation;
        }