开发者

facebook sdk invite friends to application

I want to allow users to invite friends to a facebook app through the Facebook c# sdk. I'm not keen on using the popups or any flakey meta 开发者_运维问答language. is there a way to do this without resorting to popups?


invite facebook friend from your application or website,use this small lines of code and send invitation to all facebook friends to visit your website.i also used this script its working nicely. your domain must be ssl certified because facebook not allowing unsecured domains.

<script src="http://connect.facebook.net/en_US/all.js"></script>

<script>
FB.init({
appId:'APP_ID',
cookie:true,
status:true,
xfbml:true
});

function FacebookInviteFriends()
{
FB.ui({
method: 'apprequests',
message: 'Your Message diaolog'
});
}
</script>


//HTML Code
<div id="fb-root"></div>
<a href='#' onclick="FacebookInviteFriends();"> 
Facebook Invite Friends Link
</a>


The best way to do this is via Requests 2.0. That is what FB recommends.

There is a blog post about it on Facebook Developers here: http://developers.facebook.com/blog/post/464/

It's actually quite simple:

FB.init({ 
  appId:'YOUR_APP_ID', cookie:true, 
  status:true, xfbml:true 
});

FB.ui({ method: 'apprequests', 
  message: 'Here is a new Requests dialog...'});

Behind the scenes, FB has made it a bit trickier to track the requests, but with the C# SDK it's just a graph call.


Using c# Facebook SDK on codeplex (facebooksdk.codeplex.com), you can send invitations to your friends by the following codes:

    var fb = new FacebookWebClient();
    dynamic parameters = new ExpandoObject();
    parameters.appId = "{yourAPPid}";
    parameters.message = "{yourmessage}";

    dynamic id = fb.Post("me/apprequests", parameters);

Best of Luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜