Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I want to thank you for your post, it was really helpful. For me, it was still posting on my Facebook page as ME (not as page). I think it is just the way i get the token. Although, the foreach loop was not working for me. So, I did this:</p> <pre><code>public void postFacebook(object sender, EventArgs e) { //You will get your "myAccessToken" at this adress: //https://www.facebook.com/dialog/oauth?client_id=&lt;YOUR_APP_ID&gt;&amp;redirect_uri=&lt;THE_PAGE_YOU_WILL_RECEIVE_YOUR_TOKEN_AT&gt;&amp;scope=offline_access,manage_pages,publish_stream&amp;response_type=token string myAccessToken = "&lt;IN_THE_RETURNED_URL_BELOW&gt;"; string myPageId = "&lt;YOUR_FAN_PAGE_ID&gt;"; Dictionary&lt;string,string&gt; fbParams = new Dictionary&lt;string,string&gt;(); fbParams["message"] = "Testing 1 2 test"; fbParams["caption"] = string.Empty; fbParams["description"] = string.Empty; fbParams["req_perms"] = "publish_stream"; fbParams["scope"] = "publish_stream"; //Initialize Your Facebook Client in the manner that suits you, I did it by supplying a saved access token from a single users Facebook.FacebookAPI fbClient = new Facebook.FacebookAPI(myAccessToken); //Get the listing of accounts associated with the user var fbAccounts = fbClient.Get("/me/accounts"); //Loop over the accounts looking for the ID that matches your destination ID (Fan Page ID) foreach (var account in fbAccounts.Dictionary["data"].Array) { if (account.Dictionary["id"].String == myPageId) { //When you find it, grab the associated access token and put it in the Dictionary to pass in the FB Post, then break out. fbParams["access_token"] = account.Dictionary["access_token"].String; //Update the Access token (to post as the page). If you don't it will post as YOUR personal name. fbClient.AccessToken = fbParams["access_token"]; break; } } //Then pass your destination ID and target along with FB Post info. You're Done. dynamic publishedResponse = fbClient.Post("/" + myPageId + "/feed", fbParams); } </code></pre> <p>By the way, you will need this sdk: <a href="https://github.com/facebook-csharp-sdk" rel="nofollow">SDK</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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