private static SiteLinksFeed createSiteLinksFeed(FeedService feedService)
{
SiteLinksFeed siteLinksData = new SiteLinksFeed();
// Create attributes.
FeedAttribute textAttribute = new FeedAttribute();
textAttribute.type = FeedAttributeType.STRING;
textAttribute.name = "Link Text";
FeedAttribute urlAttribute = new FeedAttribute();
urlAttribute.type = FeedAttributeType.URL;
urlAttribute.name = "Link URL";
// Create the feed.
Feed siteLinksFeed = new Feed();
siteLinksFeed.name = "Feed For Sitelinks";
siteLinksFeed.attributes = new FeedAttribute[] {textAttribute, urlAttribute};
siteLinksFeed.origin = FeedOrigin.USER;
// Create operation.
FeedOperation operation = new FeedOperation();
operation.operand = siteLinksFeed;
operation.@operator = Operator.ADD;
// Add the feed.
FeedReturnValue result = feedService.mutate(new FeedOperation[] {operation});
Feed savedFeed = result.value[0];
siteLinksData.SiteLinksFeedId = savedFeed.id;
FeedAttribute[] savedAttributes = savedFeed.attributes;
siteLinksData.LinkTextFeedAttributeId = savedAttributes[0].id;
siteLinksData.LinkUrlFeedAttributeId = savedAttributes[1].id;
return siteLinksData;
}