+ Start a Discussion

Unable to read Email address and Subject of selected Email in Emails Application Pane Component

Following up on the provided example from documentation - Create Components for Lightning for Outlook (Beta), I am able to display the selecetd email's data in html form, but when I try to read the same variables in INIT JS controller method, I get undefined/null values.

<aura:component implements="clients:availableForMailAppAppPage,clients:hasItemContext">

    <aura:attribute name="source" type="String" access="global" />
    <aura:attribute name="people" type="Object" access="global" />
    <aura:attribute name="subject" type="String" access="global" />

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <div id="content">
        <h1><b>Email subject</b></h1>
        <span id="subject">{!v.subject}</span>

        <aura:iteration items="{!v.people.to}" var="to">
            {!to.name} - {!to.email} <br/>

        {!v.people.from.name} - {!v.people.from.email}

        <aura:iteration items="{!v.people.cc}" var="cc">
            {!cc.name} - {!cc.email} <br/>

        <span class="greeting">{!v.greeting}</span>, {!v.subject}!

    doInit : function(component, event, helper) {
        var sc = component.get('v.source');
        var sb = component.get('v.subject');
        var pp = component.get('v.people');
        console.log('== people [S] == ');
        console.log('Source: '+sc);
        console.log('Subject: '+sb);
        console.log('== people [E] == ');

The console output from above code snippet is this:
== people [S] == 
Source: undefined
Subject: undefined
== people [E] ==

I am unable to figure out what I'm doing incorrectly to read the selected email's attributes? Though when I launch this component in sidebar I do get the displayed html render the values correctly like this:
Email subject
Another Email
Varun C - testing@testing123.onmicrosoft.com
Varun C - testemailfrom@yahoo.com

, Another Email!

What could be wrong in my doInit method code that I'm getting null values but when I put same attribute values in component html, and it renders the values correctly, could it be a bug or I'm missing something here?

_Zach Boyd_Zach Boyd
The documentation specifies that the attributes are added automatically to your component. If you are redefining them then you might be overwriting the value. Could you try removing and see what happens? Also, it does use events to handle value changes. Not sure if you will need those or not.
Well, removing the attributes did not have any effect, I'm still getting null in Init Handler.

But, adding the change handlers for People and Subject had some positive outcome. Under Subject change handler function I could get all three parameter values while under People change handler I could get values for only People attribute.