Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've decided to post this answer, because I was curious myself about how I would go about doing this through C#, because I'm trying to teach myself it at the moment.</p> <p>None of the code is tested, but I just hoped that I could use information from the web to try to put something basic together, that with a little bit of tweaking might get something working for you.</p> <p>Just in case you haven't found it yet you'll find the Facebook C# SDK and an example <a href="https://github.com/facebook/csharp-sdk/blob/master/examples/Program.cs" rel="nofollow">here</a></p> <p>In order for a user to manage a page, they must follow the authentication flow specified in the docs <a href="http://developers.facebook.com/docs/authentication/" rel="nofollow">here</a>.</p> <p>To do this, you request the user to authorise your app using your APP_ID as normal, but you'll need the permissions manage_pages and publish_stream:</p> <pre><code>https://www.facebook.com/dialog/oauth? client_id=YOUR_APP_ID&amp;redirect_uri=YOUR_URL&amp;scope=manage_pages,publish_stream&amp; response_type=token </code></pre> <p>So by whatever means possible (a browser window?), you must get a user to accept the permissions, to allow your application to access the user's pages.</p> <p>From then on, once the user has accepted, you can make simple API calls (get and POST) as shown in the example, at the moment it's showing:</p> <pre><code>JSONObject me = api.Get("/4"); Console.WriteLine(me.Dictionary["name"].String); </code></pre> <p>This is the user_id '4', Mark Zuckerberg.</p> <p>So by looking at the C# SDK Core, there is a function called api.MakeRequest(), so I'm guessing that you do something similar to this:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using Facebook; namespace FacebookSampleApp { class Program { static void Main(string[] args) { // Get an access token in some manner. // By default you can only get public info. string token = null; Facebook.FacebookAPI api = new Facebook.FacebookAPI(token); var parameters = new Dictionary { { "message", 'Wow, I love Google!' }, { "name" , 'Google' }, { "description" , 'Description of post' }, { "picture", 'http://www.google.com/logo.png' }, { "caption" , 'This is google.com' }, { "link" , 'http://www.google.com' }, { "type" , "link" } }; JSONObject wallPost = api.MakeRequest("/[PAGE_ID]/feed", 'POST', parameters); } } } </code></pre> <p>I have no doubts that this code won't work straight off, it's going to take some trial and error, but I hope that I've managed to help you in some way.</p> <p>Random Sources:</p> <p><a href="http://www.jamescrowley.co.uk/2011/02/03/posting-to-facebook-page-using-c-sdk-from-offline-app/" rel="nofollow">http://www.jamescrowley.co.uk/2011/02/03/posting-to-facebook-page-using-c-sdk-from-offline-app/</a> http://developers.facebook.com/docs/reference/api/post/ <a href="https://github.com/facebook/csharp-sdk/blob/master/examples/Program.cs" rel="nofollow">https://github.com/facebook/csharp-sdk/blob/master/examples/Program.cs</a> http://developers.facebook.com/tools/explorer/?method=GET&amp;path=2439131959 <a href="http://developers.facebook.com/docs/reference/api/page/" rel="nofollow">http://developers.facebook.com/docs/reference/api/page/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload