user3374374
user3374374

Reputation: 11

Facebook app read_mailbox not working ( how shoud i set it )

i'm writing now a windows phone application and I need read_mailbox permission, in my dev account in facebook a did this: 1) I go to App details section 2) I click the button Configure App Center Permissions in app center permission editbox I set up read_mailbox and I click save.

BUT i'm still getting in my app the exception message wich says that my application need these permissions , what is wrong ? that's my piece of code, written in C#

        try
        {

            FacebookClient _fb = new FacebookClient(Global.GAccessToken);

            var query = "SELECT body, author_id, viewer_id, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id)";

            dynamic parameters = new ExpandoObject();
            parameters.q = query;

            dynamic result = await _fb.GetTaskAsync("fql", parameters);

            // TODO with the result
        }
        catch (FacebookApiException ex)
        {
            string str =   ex.Message;
        }

Upvotes: 0

Views: 286

Answers (1)

user3374374
user3374374

Reputation: 11

I solved my problem using facebook button

 <FacebookControls:LoginButton 
            x:Name="btnFacebook" 
            Margin="0,0,272,258"
            HorizontalAlignment="Right" 
            ApplicationId="418614261571757"
            SessionStateChanged="OnSessionStateChanged" 
            UserInfoChanged="OnUserInfoChanged"
            Width="174"
            Height="66" 
            RenderTransformOrigin="0.523,1.49"
            VerticalAlignment="Bottom"
            Permissions="publish_stream,email,user_location,offline_access,read_mailbox"
            />

now I'm able to use async tasks and get the messages from my mailbox : Example

private async void FqlAsyncExample()
   {
       try
       { 
           FacebookClient fb = new FacebookClient(Global.GAccessToken); 
           var query = "SELECT body, author_id, viewer_id, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0)";

           dynamic parameters = new ExpandoObject();
           parameters.q = query;

           dynamic result = await fb.GetTaskAsync("fql", parameters);

...

Upvotes: 1

Related Questions