简体   繁体   English

发布到朋友墙

[英]Post to a friends wall

I have an MVC4 application that uses OAuth to login via facebook. 我有一个使用OAuth通过Facebook登录的MVC4应用程序。 Once logged in the user can then choose a guestlist from their Facebook Friends. 登录后,用户可以从其Facebook好友中选择一个访客列表。 This is fine as I am managing to retrieve the facebook Friends and their ID's. 这很好,因为我正在设法检索facebook好友及其ID。

Now I want to be able to post to the Friends wall a message from the application. 现在,我希望能够将来自应用程序的消息发布到“朋友”墙。 Is this possible at th moment as there seems to have been a lot of changes to what Facebook allows you to do, if a wall post is not possible, can a private message be sent? 这是可能的吗,因为Facebook允许您进行的更改似乎已经很多,如果无法进行挂墙留言,可以发送私人消息吗?

I have no code snippets from this one, just direction would be appreciated. 我没有这方面的代码片段,请多多指教。

Thanks 谢谢

I have used this code for posting on friend wall 我已使用此代码在朋友墙上发布

var fbApplication = new DefaultFacebookApplication { AppId = fbapp, AppSecret = fbsec };
            var current = new FacebookWebContext(fbApplication);

            Facebook.Web.FacebookWebClient client = new Facebook.Web.FacebookWebClient(token);
            //client.AccessToken = current.AccessToken;   
            dynamic parameters = new ExpandoObject();
            parameters.message = "";
            parameters.link = link;
            parameters.name = name;
            parameters.caption = caption;
            parameters.description = desc;
            parameters.from = fromId;//your fb ID
//friendId will be the ID of the person,you wants to post on wall
            object resTest = client.Post("/" + friendId + "/feed", parameters);

Alternatively you can use Graph API's feed dialog 或者,您可以使用Graph API的供稿对话框

check this 检查这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM