annonymously
annonymously

Reputation: 4708

How to get facebook access token in winforms

I'm new to the facebook c# sdk, and I'm trying to create a program that will post to a page's timeline.

I have been trying to follow this, however I'm having difficulty understanding the second code snippet since it makes use of the Request class, in asp.net. I can't find a way to translate this into WinForms.

(I did have to change the FacebookAPI to FacebookClient)

How can I achieve the same effect, of redirecting to facebook and receive the code to get an access token?

Upvotes: 2

Views: 2447

Answers (2)

Simon Mourier
Simon Mourier

Reputation: 139226

There is a specific Winforms sample for the facebook SDK available here: Facebook Sample using Facebook C# SDK with WinForms

This sample demonstrates the use of Facebook C# SDK v6 as a WinForms sample.

Note: This sample does not necessarily demonstrate the best use but rather features of using Facebook C# SDK on a desktop app. It is always recommended to use asynchronous (XAsync or XTaskAsync) methods rather then the synchronous methods. XTaskAsync methods are preferred over XAsync methods.

Upvotes: 2

Jon Newman
Jon Newman

Reputation: 238

If you're just posting to your own page's timeline, the easiest way is probably a PowerShell script using the New-FBPost cmdlet: http://facebookpsmodule.codeplex.com

Upvotes: 0

Related Questions