Post On Facebook Page As Page Not As Admin User Using Facebook C# SDK

后端 未结 4 820
北海茫月
北海茫月 2021-01-01 04:10

I\'m developing C# application which manages fan page on Facebook which uses Facebook C# SDK. I\'ve encountered two problems one is connected with posting messages on wall a

4条回答
  •  孤城傲影
    2021-01-01 04:54

    For posting a message, you need to grant the manages_pages permission, and obtain an access token from the accounts for the Fan Page by using the results of "/me/accounts".

    Here's what I use for posting a message itself to a Fan Page:

                                var dicParams = new Dictionary();
                            dicParams["message"] = stSmContentTitle;
                            dicParams["caption"] = string.Empty;
                            dicParams["description"] = string.Empty;
                            dicParams["name"] = smContent.CmeUrl;
                            dicParams["req_perms"] = "publish_stream";
                            dicParams["scope"] = "publish_stream";
    
                            // Get the access token of the posting user if we need to
                            if (destinationID != this.FacebookAccount.UserAccountId)
                            {
                                dicParams["access_token"] = this.getPostingUserAuthToken(destinationID);
                            }
                            publishResponse = this.FacebookConnection.Post("/" + destinationID + "/feed", dicParams);
    

提交回复
热议问题