Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post as link type with Facebook Graph API

Tags:

facebook

I am using the Facebook Graph API to publish on a user's wall. I give it these parameters:

message
name
description
picture
link
caption

It posts to the wall, but it is not treating it as a link. I know this because it does not open a new tab when the link is clicked, there is no share action link, and Twitter does not pick it up because I have it filtering my wall by links only.

I see the Facebook docs has two separate documentation pages for publish "Post" and "Link" objects.. but the links is posting to the same graph path so I am not sure how it is supported to work:

http://developers.facebook.com/docs/reference/api/post

http://developers.facebook.com/docs/reference/api/link

Anyone got this working?

like image 378
TruMan1 Avatar asked Sep 19 '10 14:09

TruMan1


1 Answers

Use the facebook API's available on codeplex.com and try this out,

Facebook.Rest.attachment_media_image image1 = new attachment_media_image();

image1.href = "";
image1.src = "";

Facebook.Rest.attachment a = new Facebook.Rest.attachment();
a.media = new List<Facebook.Rest.attachment_media> { image1 };
a.href = "";
a.name = "";
a.caption = "{*actor*}";
a.properties = null;

if(fbapi.Users.HasAppPermission(Enums.ExtendedPermissions.publish_stream))
    fbapi.Stream.Publish(" Your message", a,
                         new List<action_link>()
                         {
                             new action_link() 
                             {
                                 text = "",                                      
                                 href = ""
                             } 
                         },
                         null, 0);
like image 163
Adi_aks Avatar answered Oct 21 '22 16:10

Adi_aks