"Feed.publishUserAction cannot be used to automatically publish one-line stories on Connect sites." error while posting on wall

Jun 15, 2009 at 8:02 AM
Edited Jun 15, 2009 at 8:39 AM

Hi Guys,

I want to post some content on wall, here goes my code...

 long templeateid = <my templateid>

var oneLineStory = new List<string> { "{*actor*} says \"{*todays_msg*}\" today" }; var templateData = new Dictionary<string, string>();

templateData.Add(

templateData.Add(

"actor", "Sumit"); "todays_msg", "Hello how r u?");var userid = new List<long>{api.uid};

 

 

bool flg = api.feed.publishUserAction(templeateid, templateData, userid, "Sumit had added a story", feed.PublishedStorySize.OneLine);

This code gives me error as "Feed.publishUserAction cannot be used to automatically publish one-line stories on Connect sites."

I execute this code after logging in. I have written the code to get friends list above this code, and i am able to get the friends list sucessfully.

 

Jun 15, 2009 at 10:49 AM

Hi All,

 

Here is the code to post on wall  but before that you have to give the application permission

 

 

 

 

 

 

 

 

 

 

 

 

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

string

</font></font><font size="2" color="#0000ff">

 

</font>

 

oneLineStoryTemplate = "{*actor*} is Testing the application<br>is Testing the applicationis Testing the application<br>is Testing the applicationis Testing the application<br>is Testing the applicationis Testing the application<br>is Testing the applicationis Testing the application<br>is Testing the applicationis Testing the application<br>is Testing the application <a href='http://www.facebook.com/apps/application.php?id=xxx'>Hi</a>."

;<font size="2">

 

</font>

 

string shortStoryTemplateTitle = "{*actor*} is been <a href='http://www.facebook.com/apps/application.php?id=xxx>eating Poker!</a>"

;<font size="2">

 

</font>

 

string shortStoryTemplateBody = "short story body"

;<font size="2">

 

</font>

 

string fullStoryTemplateTitle = "{*actor*} is <a href='http://www.facebook.com/apps/application.php?id=xxx>eating Poker!</a>"

;<font size="2">

 

</font>

 

string fullStoryTemplateBody = "full story body"

;<font size="2">

 

</font>

 

Collection<facebook.Schema.feed_image> images =null

;<font size="2">

 

</font>

 

List<string> oneLineTemplates = new List<string

> { oneLineStoryTemplate };<font size="2">

 

</font>

 

List<long> traget_ID = new List<long

> { 1811739843 };<font size="2">

 

</font>

 

feedTemplate shortStoryTemplate = new feedTemplate { PreferredLayout = "1"

, TemplateBody = shortStoryTemplateBody, TemplateTitle = shortStoryTemplateTitle };<font size="2">

 

</font>

 

List<feedTemplate> shortStoryTemplates = new List<feedTemplate

> { shortStoryTemplate };<font size="2">

 

</font>

 

feedTemplate fullStoryTemplate = new feedTemplate { PreferredLayout = "1"

, TemplateBody = fullStoryTemplateBody, TemplateTitle = fullStoryTemplateTitle };<font size="2">

 

</font>

 

Dictionary<string, string> tempelatedata = new Dictionary<string, string> { { "app", "Facebook Developer Toolkit" }, { "num_stars", "5"

} };<font size="2">

 

</font>

 

long

x = _fbService.feed.registerTemplateBundle(oneLineTemplates, shortStoryTemplates, fullStoryTemplate);<font size="2">

_fbService.feed.publishUserAction(x, tempelatedata, traget_ID,

</font>

 

"check it", feed.PublishedS.Full);