Status Update example

Apr 4, 2011 at 6:19 PM

Hello,

I was wondering if anyone could post a code example of how to use the FaceSharp SDK to simply post to a users wall. I have the code written to obtain the access token, but can not figure out how to do the simplest thing a developer would want to do with facebook app... post a new status. Every time I find example that i think are promising, they get so complex and confusing that I don't think I'm looking in the right spot. Using SDK's with OAuth for other social network site, this is soooooo  simple, and takes all of 15 lines of code total... there must be a simple code example out there for this... if someone could please help by posting an example in C# or VB.Net to post a new status (I already have the access Token, so I don't need code to obtain that... the point of the app is to use offline access, after the user "allows" the app, and I store the Access Token for then to use each time they use my app... all I need is the post new status example for this... pleeaaassseee), I would greatly appreciate it... THANK YOU!!

Coordinator
Apr 4, 2011 at 6:43 PM

No problem,

Here's a quick example:

            var accessToken = "12321lkj321lk3j21lk321j";
            var facebookApi = new FacebookApi(accessToken);
            string toUserId;
            string message = "Facesharp makes it easy!";

            facebookApi.Feed.Publish(
                toUserId,
                message,
                (String.Format("{0}://{1}/{2}", Request.Url.Scheme, Request.Url.Authority, "areas/facebookapp/images/logo-facesharp.gif")),
                "http://facesharp.codeplex.com",
                "FaceSharp",
                "The .NET Facebook Starter Kit",
                "Get started with Facebook Development Today!"
                );

 

Apr 4, 2011 at 6:59 PM

Thank you!!

Apr 4, 2011 at 10:53 PM

Last question on this.... 

In the libraries of the download available for Facesharp, I don't see any .dll's named "facebook" or "FacebookApi" ... There one that start with Castle... or Hammock or.. Newtonsoft.Json... System. or... nunit.framework.dll.... which one actually contains the facebook methods?

Apr 4, 2011 at 11:25 PM

okay, so I got it to work by just importing the actual whole set of .cs files... I would think this would be include in a .dll, but that's fine, at least I got it.. Thanks!

Apr 5, 2011 at 1:10 AM

Last one... really....

 

What do I need be able to use," Request.Url.Scheme, Request.Url.Authority" and not have a red error line under "request"? 

Apr 5, 2011 at 6:55 PM

so the answer issssss........ import (or) using System.Net 

I'm done! thanks!

Coordinator
Apr 5, 2011 at 8:12 PM

I've created an example at : http://facesharp.codeplex.com/wikipage?title=Authentication%20Guide