Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use the Facebook C# SDK to post on Facebook Pages

I have already requested and gained access to 'manage_pages' and 'publish_stream' permissions from a user. How can I use the c# SDK to get permission to post to one of that user's Business Pages wall (They must select one if they Admin multiple Pages, right?). Once I have that access, what is the best method to use the SDK to post to the Business Page wall?

On a related note, can the C# SDK run under ASP.NET 3.5 effectively? Rackspace Cloud Sites is not allowing .NET 4.0 on production servers yet, so I need to see code examples that don't use the 'dynamic' or 'ExpandoObject' keywords.

Thanks!

like image 409
Corgalore Avatar asked Dec 05 '10 22:12

Corgalore


1 Answers

following is the code if it helps you

FacebookApp fbApp = new FacebookApp();
FacebookApp app = new FacebookApp(fbApp.Session.AccessToken);
var args = new Dictionary<string, object>();
args["message"] = "abc";
args["caption"] = "This is caption!";
args["description"] = "This is description!";
args["name"] = "This is name!";
args["picture"] = "[your image URL]";
args["link"] = "[your link URL]";

app.Api("/me/feed", args, HttpMethod.Post);

You need to replace /me in app.Api's arguments to the specific id of page. I'm not sure if its the right way, but it works for wall post of a user :-)

like image 198
M N Shaukat Avatar answered Oct 04 '22 20:10

M N Shaukat