How to request extended permission? (email)

Aug 24, 2010 at 2:01 PM

Hi,

I'm kind of new to the facebook developer toolkit but I got a sample IFrame page up and running just fine.

Since I need to access email address I need to request email extendPermission.

I tried:

 public partial class Default : Facebook.Web.CanvasIFrameBasePage
    {
        protected void Page_PreInit(object sender, EventArgs e)   
        {   
            base.RequireLogin = true;

            base.RequiredPermissions = new List<Facebook.Schema.Enums.ExtendedPermissions>();
            base.RequiredPermissions.Add(Facebook.Schema.Enums.ExtendedPermissions.email);

            
        }   

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }

When I try to run this I get some security exceptions from Facebook.

What is the proper way to request extended email permission?

Thanks!

Sep 30, 2010 at 4:50 AM

Hi,

I'm also having a problem in requesting email extendPermission.

 I wasted lots of hours finding a solution.

I'm very much Thankful if you can give me the code to request extendPermission.

Thanks,

Madhu

Sep 30, 2010 at 8:43 AM

This is the permission code:

 

 

<cc1:PromptPermission ID="email" runat="server" Perms

="email">

 

 

 

 

 

<ContentTemplate>

You must first click here to enable the publishing function.

 

 

</ContentTemplate>

 

 

</cc1:PromptPermission>



cs code:



if (base.Api.Users.HasAppPermission(Facebook.Schema.Enums.ExtendedPermissions.email))
        {

            string result = base.Api.Fql.Query("SELECT email FROM user WHERE uid=" + u.uid.ToString());

            XmlDocument x = new XmlDocument();

            x.LoadXml(result);

            XmlNode email_xml = x.GetElementsByTagName("email").Item(0);

            Response.Write(email_xml.InnerText);

        }

 

 
  

Sep 30, 2010 at 8:57 AM

Hi,

Thanks for the reply.

But my requirement is different, I need to ask for the extended permission on loading the application, not after clicking a button.

Thanks,

Madhu