tags:

views:

262

answers:

3

I apologize if this has already been answered, but all the information out there on Facebook publishing is so confusing and conflicting, I haven't been able to get anything to work yet. I'm trying to set up an application that runs on my local server to publish content to my organization's fan page (this will tie in with my WCMS to cross-post content). I believe I want a Facebook Connect application to do this which I've set up properly in Facebook and gotten an application key and secret. Here's the code I'm trying to execute, but each time it's run I get "User has not authorized access" even if I'm just trying to publish to the application wall.

ConnectSession fbSession = new ConnectSession("APP_KEY", "APP_SECRET");
Api fbAPI = new Api(fbSession);
fbAPI.Stream.Publish("hello world");

I've also tried:

fbAPI.Stream.Publish("hello world", null, null, FAN_PAGE_ID, APP_ID);

I've granted my application access to publish on the fan page.

EDIT:

I've tried turning this into a Desktop application instead because it appears as though Javascript needs to be involved in order for it to be a Connect application. Here's the updated session initialization line. This now gives me a "Incorrect signature error."

DesktopSession fbSession = new DesktopSession("APP_KEY", false);
A: 

Does the code give a specific error?

Does the ConnectSession class have a status which could be checked for a status which might give a hint to the failure?

OmegaMan
The only error I was able to find was "User has not authorized access." It looks like maybe a Facebook Connect app was not the way to go as I will be running this as a server-process and not an actual web application. I've tried making it a Desktop Application (see edited code above), but that is getting an "Incorrect Signature" error.
Kyle
You are posting questions here not answers. Please post questions to the questions in the Comments above.
Glennular
+1  A: 

There is a similar question titled "How can I post to a facebook wall from a c# web service?" for which I provided a very lengthy answer, specifically indicating how to post to a page.

casperOne
Thanks for the help. This all looks great. I can't quite figure out how to get the Client Secret though. Do you have any more detailed info on this?
Kyle
A: 

casperOne's solution works, however, I found this article to be the best solution.

http://tech.karolzielinski.com/publish-post-of-facebook-page-wall-as-a-page-not-a-user-python-facebook-rest-api

This authorizes the application to post directly to the Fan Page without having to go through an admin account.

Kyle