publishUserAction not showing image

Feb 9, 2009 at 9:41 PM
Edited Feb 9, 2009 at 10:38 PM
First off here's my bug on facebook, just in case it doesn't have to do with the API:

http://forum.developers.facebook.com/viewtopic.php?pid=125121#p125121

Here is my code that I'm using:

var path = new Dictionary<string, string>();
var jsonPaths = new List<string>();

facebook.Schema.photo lastPhoto = petPhotos[petPhotos.Count - 1];

int ID = Int32.Parse(facebookUserID);

List<long> friends = new List<long>();
IList<facebook.Schema.user> appFriends = _fbService.friends.getUserObjects();
foreach (facebook.Schema.user friendID in appFriends)
     {
           friends.Add((long)friendID.uid);
      }

path.Add("src", lastPhoto.src);
path.Add("href", "http://apps.facebook.com/merckpethealthcenter/defaultFB.aspx");
jsonPaths.Add(JSONHelper.ConvertToJSONAssociativeArray(path));
string images = JSONHelper.ConvertToJSONArray(jsonPaths);
var templateData = new Dictionary<string, string>();

templateData.Add("images", images);
test.Text = JSONHelper.ConvertToJSONAssociativeArray(templateData);
_fbService.feed.publishUserAction(49288471131, templateData, friends, "", facebook.feed.PublishedStorySize.Short);


It will publish the story but will not publish the image.

I tested it in the template bundle tool and pasted this:

{"images":[{"src":"http:\/\/photos-g.ak.fbcdn.net\/photos-ak-sf2p\/v650\/43\/13\/6024376\/s6024376_41327886_7368.jpg","href":"http:\/\/apps.facebook.com\/merckpethealthcenter\/defaultFB.aspx"}]}     

which is the output of test.Text = JSONHelper.ConvertToJSONAssociativeArray(templateData);

And it shows the image in the test.

So I have no clue what is wrong. Anyone?

UPDATE:

SOO here is what I found out from testing more. It for some reason ONLY publishes one-line stories, even if I have it set to facebook.feed.PublishedStorySize.Short, and I have permissions for the story on another account to publish short stories, it STILL publishes one line stories.




Mar 28, 2009 at 3:56 PM
It's only publishing one-liners because that's the default action.  You will need to either manually update the default Feed Story size or prompt the user to allow a larger story.

The size of the Feed story. You can specify 1 (one line) or 2 (short). The one line story is the default, and users have to opt into using short stories at time of publication or through their privacy settings. Otherwise, if the user has not allowed that particular size to be published through the API, then the story size will be demoted to match the user's preference. (Default value is 1.)

To manually update the allowable story size, do the following:
  1. Browse to the App Edit Page (http://www.facebook.com/editapps.php)
  2. Click Edit Settings for the Application you wish to modify.
  3. Change the default setting to Allow [APP] to publish specific story sizes automatically without prompting.
  4. Pick Short or Full as your new story default.  
I've tested Short stories and they work great.  I haven't tested publishing Full stories so I can't say if they work or not..
Mar 30, 2009 at 5:44 PM
I am trying to do the same using Facebook Connect platform. Can you please tell me if you did the same using facebook connect? 
When I tried I got this error message "Feed.publishUserAction cannot be used to automatically publish one-line stories on Connect sites."

Am also looking if somebody has published stories using Feed Forms. Please do share if somebody has attempted this already.

Thanks in advance.
Apr 1, 2009 at 9:22 PM
Is there any way to post the images without using the JSONhelper? Or rather can anyone show me the string the goes here after the JSONhelper converts it:

template_data.Add("images","***whatgoeshere?***");

Thanks!
Joe
Apr 3, 2009 at 4:20 PM
Edited Apr 3, 2009 at 8:41 PM
@geograd: Yes, Even I experienced exactly the same thing as you did. Irrespective of choosing short story it still published only one line story, although i dont think its a problem with api inside 
facebook as one of my colleague who used google's java facebook kit was able to successfully post a one line story or a short story.

@mikulicz40: Can you please confirm that it works for you? if possible some more information on how you were able to successfully post a short story. Yes I do understand that I have change 
the settings for the story size.

i.e. To manually update the allowable story size, do the following:
  1. Browse to the App Edit Page (http://www.facebook.com/editapps.php)
  2. Click Edit Settings for the Application you wish to modify.
  3. Change the default setting to Allow [APP] to publish specific story sizes automatically without prompting.
  4. Pick Short or Full as your new story default.  
Even after that it does not publish short but one liners..

UPDATE: 

It all is based on target Ids in the dotnet API. I found that if target Id's are passed in the API (feed.publishUserAction) then the 
story that is chosen to publish is a one line story. Or otherwise if the no targetIds are passed then the story that is chosen to publish 
is a short story (Irrespective of whether the template supports or not). Remember in all cases the short story size is obviously chosen 
as 2 in this case and the settings chosen to allow short stories to publish automatically.

thanks
Apr 3, 2009 at 5:22 PM
guys, read the facebook documentation on news feed before. all your questions will be answered
Apr 7, 2009 at 4:10 PM
My problem was that I couldn't find the JSONHelper. This might help people:

            var path = new Dictionary<string, string>();
            var jsonPaths = new List<string>();

            path.Add("src", string.Concat("http://image.jpg"));
            path.Add("href", "http://apps.facebook.com/_ranqit");
            jsonPaths.Add(facebook.Utility.JSONHelper.ConvertToJSONAssociativeArray(path));
            string images = facebook.Utility.JSONHelper.ConvertToJSONArray(jsonPaths);

            //string images = "";
            template_data.Add("images", images);
May 4, 2009 at 1:14 PM

Hi,
I have same problem but in my application edit settings its have only one option like "Publish recent activity (one line stories) to my wall" its not have short or full story option.
I uncheck that option the facebook apis gives this error "Permissions error". Please help me if you know solution for this problem
May 4, 2009 at 3:49 PM
Same problem here... My app only has one option too.
May 26, 2009 at 3:47 AM

Me too. I only have this option: "Publish recent activity (one line stories) to my wall"

@mexpedith  - can you please explain

"Or otherwise if the no targetIds are passed then the story that is chosen to publish is a short story (Irrespective of whether the template supports or not). "

 

THANKS!