简体   繁体   English

facebook sdk邀请朋友申请

[英]facebook sdk invite friends to application

I want to allow users to invite friends to a facebook app through the Facebook c# sdk. 我想允许用户通过Facebook c#sdk邀请朋友加入Facebook应用程序。 I'm not keen on using the popups or any flakey meta language. 我不热衷于使用弹出窗口或任何flamet元语言。 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. 从您的应用程序或网站邀请Facebook朋友,使用此小段代码,并将邀请发送给所有Facebook朋友,以访问您的网站。我也很好地使用了此脚本。 your domain must be ssl certified because facebook not allowing unsecured domains. 您的域必须经过ssl认证,因为facebook不允许使用不安全的域。

<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. 最好的方法是通过Requests 2.0。 That is what FB recommends. 那就是FB的建议。

There is a blog post about it on Facebook Developers here: http://developers.facebook.com/blog/post/464/ 在Facebook Developers上有一篇关于它的博客文章: 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. 在后台,FB使跟踪请求变得有些棘手,但是对于C#SDK,这只是一个图形调用。

Using c# Facebook SDK on codeplex (facebooksdk.codeplex.com), you can send invitations to your friends by the following codes: 使用Codeplex(facebooksdk.codeplex.com)上的c#Facebook SDK,您可以通过以下代码将邀请发送给您的朋友:

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

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

Best of Luck! 祝你好运!

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

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