How can I use the Facebook C # SDK to post to Facebook pages

I already requested and got access to the manage_pages and publish_stream permissions from the user. How can I use the C # SDK to get permission to publish on one of the pages of the User’s Business Page (they must choose one if they administer multiple pages, right?). Once I have such access, what is the best way to use the SDK to publish on the wall of a business page?

In a related note, can the C # SDK work under ASP.NET 3.5 effectively? Rackspace Cloud Sites does not yet allow .NET 4.0 on production servers, so I need to see code examples that do not use the keywords "dynamic" or "ExpandoObject".

Thank!

+5
source share
3 answers

Below 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 the app.Api arguments with the specific page id. I'm not sure if this is the right way, but it works on the user's wall :-)

+9
source

Here, as with C # SDK 5.1.1

FacebookClient fbClient = new FacebookClient(accessToken);
var args = new Dictionary<string, object>();
args["message"] = "Testing 123";
fbClient.Post("/me/feed", args);
+1
source
args["picture"] = "[your image URL]";
args["link"] = "[your link URL]";

URL- , localhost. , URL- .

0

All Articles