Working example of PublishTemplatizedAction (Text Only)

Jan 17, 2008 at 1:44 AM
Edited Jan 17, 2008 at 4:38 PM
Here is a code snippet of what worked for me with PublishTemplatizedAction. The news feed came the next day.
This is with the 1.6 API on C# Visual Studio 2005.

I prepared my facebook application by registering the feed with the same value for the title template as below.

I am only sending the title in the feed. No body and no images.

Here is the code that prepares the objects:

string title_template = "{actor} has added {winename} to {pronoun} cellar.";
string body_template = String.Empty;
Dictionary<string, string> dic_title = new Dictionary<string, string>(2);
dic_title.Add("winename", WineEntity.WineName);
dic_title.Add("pronoun", sex == Gender.Female ? "her" : "his");
Dictionary<string, string> dic_body = null;
this.SendTemplateFeed(titletemplate, dictitle, bodytemplate, dicbody, null);

This is the wrapper SendTemplateFeed method which calls the API (FBService is my API class):

protected void SendTemplateFeed(string titleTemplate, System.Collections.Generic.Dictionary<string,string> titleData,
string bodyTemplate, System.Collections.Generic.Dictionary<string,string> bodyData, Collection<PublishImage> images)
this.FBService.PublishTemplatizedAction(titleTemplate, titleData, bodyTemplate, bodyData, images);