Feed Publishing

The .NET Facebook API Client makes working with Feed templates stupidly easy by allowing you to define your templates in an XML file with a friendly name, and then automatically registering the templates for you when your application initializes.


  • Create an xml file with with your templates using the following format:
  <feedTemplate name="testStory">
    <oneLineTemplate>{*actor*} is kicking butt with the new .NET API Client.</oneLineTemplate>
      <title>{*actor*} is kicking butt with the new .NET API Client.</title>
      <body>The .NET API client makes posting stories like this ridiculously easy!</body>
      <text>.NET API Client</text>
  <feedTemplate name="DemoStory">
    <oneLineTemplate>{*actor*} is checking out the new .NET Facebook API Client.</oneLineTemplate>
      <title>{*actor*} is checking out the new .NET Facebook API Client.</title>
      <body>There's a new cowboy in Facebook API-towne! Yeehaw!</body>
      <text>.NET Facebook API Client</text>
It is recommended that you save the file with the .config extension so that the file cannot be downloaded.
  • Add the feedTemplateConfigSource attribute to the <facebook> configuration element in web.config (see Getting Started for more information) with the relative path of the saved file:
<facebook feedTemplateConfigSource="web.facebook.templates.config">


Note: There are currently only helpers for ASP.NET MVC applications. ASP.NET server controls are planned to provide similar functionality for a future release for WebForms applications.

FBML Applications

  • Render the feed form using the FbmlHelper.FeedForm method:
<%= Fbml.FeedForm("DemoStory", "Publish") %>
When the user clicks "publish", the FeedController will automatically handle the resulting POST from Facebook for you.

IFrame Applications

  • Render a button using the FbIFrameHelper.FeedForm method:
<%= FbIFrame.FeedForm("DemoStory", "Publish") %>
Note: additional fields are not supported at this time.

Last edited Apr 13, 2009 at 7:42 PM by DanielSchaffer, version 3


petegreg Sep 4, 2009 at 4:57 AM 
Can you add some samples for usage of the fieldName parameters please?
I'm trying to pre-populate the user_message with some dynamic content.

Not sure how this line in FBIFrameHelper should behave "form.Append(String.Format("<input type='text' id='{0}' value='{0} data')></input><br/>",fieldName));"
Is value='{0} data' correct?