Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10
My Carrier: N/A

Email Card not prepopulating

I know I am calling the card correctly, I am able to load and send an email.  I am not able to get the "preloaded" data to load into the card.  I am using the JSON from the  Email Card page.  I am pretty sure I am loading the JSON properly as I have printed the data to the console.

 

 

	InvokeManager invokeManager;
	InvokeRequest request;
	request.setTarget("sys.pim.uib.email.hybridcomposer");
	request.setAction("bb.action.COMPOSE");
	request.setMimeType("message/rfc822");

	JsonDataAccess jda;
	QMap<QString, QVariant> prefilledData;
	QVariant jsonData = jda.load(QDir::currentPath() + "/app/native/assets/mailProperties.json");
	prefilledData = jsonData.toMap();
	request.setMetadata(prefilledData);

 

Any ideas where I have gone wrong?

Please use plain text.
New Developer
mcmordie
Posts: 50
Registered: ‎01-22-2009
My Device: Z10
My Carrier: Rogers

Re: Email Card not prepopulating

Same issue here.

 

I wasn't sure if we were supposed to send the json to the metadata, data or uri fields.  I have tried all three to no avail.

 

My json:

 

{
"subject" : "Screenshot",
"body" : "Screenshot attached.",
"attachment" : "file:///shared/misc/screenshot.png"
}

 

 

invocation:

 

navigator_invoke_invocation_t *iRequest = NULL;
navigator_invoke_invocation_create(&iRequest);
navigator_invoke_invocation_set_action(iRequest, "bb.action.COMPOSE");
navigator_invoke_invocation_set_target(iRequest,"sys.pim.uib.email.hybridcomposer");
navigator_invoke_invocation_set_data(iRequest, url.c_str(), url.length());
navigator_invoke_invocation_set_type(iRequest, "message/rfc822");
navigator_invoke_invocation_send(iRequest);
navigator_invoke_invocation_destroy(iRequest);

All this does is bring up a blank composer window.

 

I need this to work properly with optional inclusion of all the possible permutations.  I see that others get around this with a mailto uri or a Share invocation, but I need the ability to populate email fields and add an attachment.

 

Is this a known issue with the current release of BB10, or am I doing something wrong?

Please use plain text.
Developer
Zmey
Posts: 1,510
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Email Card not prepopulating

I wasn't able to make this work. A workaround is to use URL:

http://supportforums.blackberry.com/t5/Cascades-Development/Email-Composer-Not-Working/m-p/2166329#M...


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10
My Carrier: N/A

Re: Email Card not prepopulating

Maybe I misread the comments but this doesn't allow for attachments, which is my biggest issue...
Please use plain text.
New Developer
mcmordie
Posts: 50
Registered: ‎01-22-2009
My Device: Z10
My Carrier: Rogers

Re: Email Card not prepopulating

That was also my understanding.  This is a blocking issue for the release of our product (or will be when the product is ready for submission in a few weeks). 

Please use plain text.
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10
My Carrier: N/A

Re: Email Card not prepopulating

I currently have:

	InvokeManager invokeManager;
	InvokeRequest request;
	request.setTarget("sys.pim.uib.email.hybridcomposer");
	request.setAction("bb.action.SHARE");
	QString fileURI = ("file://" + newFileName);
	request.setUri(fileURI);
	request.setMimeType("message/rfc822");

 but does not allow me to prepopulate the subject line as I'd like to

Please use plain text.
Contributor
sunshining
Posts: 10
Registered: ‎03-04-2013
My Device: developer
My Carrier: developer

Re: Email Card not prepopulating

same issu, the most important thing: add attachment,
do you have any solutions,now ?
Please use plain text.
Contributor
sunshining
Posts: 10
Registered: ‎03-04-2013
My Device: developer
My Carrier: developer

Re: Email Card not prepopulating

    request.setTarget("sys.pim.uib.email.hybridcomposer");
    request.setAction("bb.action.SHARE");
    request.setMimeType("message/rfc822");

    QString fileURI = ("file://assets/images/light.png");
    request.setUri(fileURI);

 

still can not add a attachment, anywhere wrong?

 

 

Please use plain text.
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10
My Carrier: N/A

Re: Email Card not prepopulating

my code, post above @sunshining adds attachment to email card, but nothing else. No subject, no to:/cc:/bcc:, just attachment
Please use plain text.
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10
My Carrier: N/A

Re: Email Card not prepopulating

@sunshining you need the full file path, use QDir::homePath() to start
Please use plain text.