where is FB.api or stream.publish in 3.0?

Nov 18, 2009 at 2:12 AM
Edited Nov 18, 2009 at 2:29 AM

I wanna post message to user's wall with FBML

I searched discussions but I could not find FB.api or stream.publish in references of  Facebook Developer Toolkit

Is any examples of C#/VB.net to post message to user's wall in toolkit 3.0 ?

Thanks so much for your help!!

 

 


 

Nov 18, 2009 at 3:55 PM

Here's an example from a console app I am building.  I keep the userid and infinite sessionkey in my database for use in this program, but you should be able to adapt this for an app where the user is logged in:

 

 

        Facebook.Session.ConnectSession connectsession = new Facebook.Session.ConnectSession(APIKEY, SECRET);
        Facebook.Rest.Api api = new Facebook.Rest.Api(connectsession);

        //assume you have offline_access extended permission, and that you saved the non-expiring session key
        //and userid for future use, and put them in an object called user
        api.Session.SessionKey = user.SessionKey;
        api.Session.UserId = user.UserID;

        Facebook.Rest.attachment_media_image myimage = new Facebook.Rest.attachment_media_image();
        //href is the link for the image if you click on it
        myimage.href = "http://mydomain.com";
        myimage.src = "http://mydomain.com/image.png";
        List<Facebook.Rest.attachment_media> mymedia = new List<Facebook.Rest.attachment_media>();
        mymedia.Add(myimage);

        Facebook.Rest.attachment myattachment = new Facebook.Rest.attachment();

        //name is bold heading for entry, to right of image
        myattachment.name = "Title of your post";
        //href is the link target for the 'name'
        myattachment.href = "http://mydomain.com";

        //caption is the long article text below the name
        myattachment.caption = "Here is the main message for the wall/stream post";

        //description appears under image
        myattachment.description = "Something to describe the image";

        myattachment.media = mymedia;

        IList<Facebook.Schema.action_link> myactionlinks = new List<Facebook.Schema.action_link>();
        Facebook.Schema.action_link myactionlink = new Facebook.Schema.action_link();
        myactionlink.href = "http://mydomain.com" ;
        myactionlink.text = "Description for hyperlink";
        myactionlinks.Add(myactionlink);

        api.Stream.Publish("", myattachment, myactionlinks, "", user.UserID);

 

 

Nov 22, 2009 at 7:02 AM
Edited Nov 22, 2009 at 10:14 AM

I always got '0' of user.UserId 

how could I fix the problem.... with FDT3.0?

 

Nov 22, 2009 at 3:48 PM

start with the samples.

what kind of app are you building...web, silverlight, console...?

post your code.

Jan 28, 2010 at 5:37 PM

Hi,

 

This code says

//assume you have offline_access extended permission, and that you saved the non-expiring session key
        //and userid for future use, and put them in an object called user

But HOW do you get the offline_access permission and get the session key & secret?

 

Thanks - if anyone can help, this is driving me up the wall!

Apr 28, 2010 at 10:44 PM
Edited Apr 28, 2010 at 10:50 PM
Hi there, I have a small problem, because It always ask me the "properties" but it value looks ugly, so I do not want to put it, but If I do not put it in my code, It says that the keyword "new" is required and I have to set that value, can anyone help me with this??? If I do not put this:

attachment_property oAdjuntar_Prop = new attachment_property();
attachment_category oAdjuntar_Cat = new attachment_category();
oAdjuntar_Cat.text = ;Aun No Disponible a usuarios. (coming soon);
oAdjuntar_Cat.href = "http://fb.address.com/";
oAdjuntar_Prop.category = oAdjuntar_Cat;


oAdjunto.properties = oAdjuntar_Prop;

I got an error, telling that <attach>.properties can not be null... I erase this entire block and get another error.