What is Connect.RegisterUser in facebook developer toolkit
How can i link my application's account to facebook? This is the code :-
BrowserSession _browserSession = new BrowserSession(ApplicationKey, new Enums.ExtendedPermissions[] { Enums.ExtendedPermissions.email, Enums.ExtendedPermissions.manage_mailbox, Enums.ExtendedPermissions.read_mailbox,
Enums.ExtendedPermissions.status_update, Enums.ExtendedPermissions.share_item, Enums.ExtendedPermissions.offline_access});
Connect connect = new Connect(_browserSession);
connect.RegisterUsersAsync(List<ConnectAccountMap>);
开发者_高级运维As you can see connect.RegisterUsersAsync requires List of ConnectAccountMap type. How do i get those ConnectAccountMaps? The properties of ConnectAccountMap are EmailAddress, AccountId and AccountUrl. But how do i get those parameters?
Thanks in advance :)
Finally, i am answering my own question. I did try Facebook C# SDK and didn't get it work. I studied the sample and changed the appId and was even successfull in login in but could not make it to work. This function failed
[ScriptableMember]
public void LoggedIn(string uri) //string sessionKey, string sessionSecret, int expires, string userId, string allowedPermissions)
{
FacebookAuthenticationResult authResult;
if (FacebookAuthenticationResult.TryParse(uri, out authResult))
{
fbApp.Session = authResult.ToSession();
loginSucceeded();
}
else
{
failedLogin();
}
}
The line FacebookAuthenticationResult.TryParse
kept failing and i was frustrated like anything. Finally i made it work using Facebook Developer Toolkit V3.1 itself.
This query works just fine :-
_fb.Fql.QueryAsync("SELECT email FROM user WHERE uid=" + u.uid, new Fql.QueryCallback((str, obj, exc) => {
Debug.WriteLine(str);
}), null);
Offcourse your application should ask for extended permissions of email. A query is compulsorily needed because in user
object of Facebook there is no property which can fetch you the real email address. You can if you want to retrieve proxied_email but most of the case that isn't what you are always looking for and hence the query ! You will get the xml which you can easily parse it using Linq To Xml or traditional Xml c# classes. Cheers!
If you are using Old Facebook Developer Toolkit here is a good example to start with.
http://facebooktoolkit.codeplex.com/Thread/View.aspx?ThreadId=45825
Other wise for new C# SDK consider having a look at
http://facebooksdk.codeplex.com/wikipage?title=Code%20Examples&referringTitle=Documentation
Hope it may help.
And FYI as mentioned here http://developers.facebook.com/docs/reference/rest/connect.registerUsers
connect.register user has been deprecated.
精彩评论