You need to sign in to do that
Don't have an account?
VarunC
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.
sampleOutlookComponent.cmp
sampleOutlookComponentController.js
The console output from above code snippet is this:
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:
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?
sampleOutlookComponent.cmp
<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> <h1>To:</h1> <aura:iteration items="{!v.people.to}" var="to"> {!to.name} - {!to.email} <br/> </aura:iteration> <h1>From:</h1> {!v.people.from.name} - {!v.people.from.email} <h1>CC:</h1> <aura:iteration items="{!v.people.cc}" var="cc"> {!cc.name} - {!cc.email} <br/> </aura:iteration> <span class="greeting">{!v.greeting}</span>, {!v.subject}! </div> </aura:component>
sampleOutlookComponentController.js
({ 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(pp); console.log('== people [E] == '); } })
The console output from above code snippet is this:
== people [S] == Source: undefined Subject: undefined null == 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 To: Varun C - testing@testing123.onmicrosoft.com From: Varun C - testemailfrom@yahoo.com CC: , 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?
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.