Answered by:
How to programmatically set a "To" field(recipient) in mail app using sharing data?

Question
-
How to programmatically set a "To" field(recipient) in mail app using sharing data?
Currently used Win8 Release Preview 8400, and I found that sharing only text or only images.Is any other way to share multiple contents? Is Win8 RTM supports all these?
Sample code
// Register the DataRequested event.
DataRequested += ref new TypedEventHandler<DataTransferManager^, DataRequestedEventArgs^>(this, &Mainpage::OnDataRequested);
// DataRequested handler
void Mainpage::OnDataRequested(DataTransferManager^ sender, DataRequestedEventArgs^ e)
{
auto requestData = e->Request;
requestData->Properties->Title = "Test";
requestData->Properties->Description = "Description";
requestData->SetText(L"Test message");
requestData->SetStorageItems(dynamic_cast<IIterable<IStorageItem^>^>(storageItems));
}
Thursday, September 6, 2012 11:06 AM
Answers
-
The purpose of the share contract is to let the user choose to share to anybody through any share target. The app cannot control which share target or contact is used. If your goal is to send to a specific address rather than to provide data for the user to share as the user wants then you can't use the share contract; you may be better off launching a mailto: protocol or connecting to a specific web service.
It is up to the share target to pick which ones it will use and how to use them. The base OS supports all of the types represented in the DataRequest plus custom types, but individual share targets will only support the ones which are relevant to them.
--Rob
- Marked as answer by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, October 25, 2012 12:03 AM
Thursday, September 6, 2012 4:01 PMModerator
All replies
-
Hi all,
How to programmatically set a "To" field(recipient) in mail app using sharing data?
Currently used Win8 Release Preview 8400, and I found that sharing only text or only images.
Is any other way to share multiple contents? Is Win8 RTM supports all these?
// Register the DataRequested event. DataRequested += ref new TypedEventHandler<DataTransferManager^, DataRequestedEventArgs^>(this, &Mainpage::OnDataRequested); // DataRequested handler void Mainpage::OnDataRequested(DataTransferManager^ sender, DataRequestedEventArgs^ e) { auto requestData = e->Request; requestData->Properties->Title = "Test"; requestData->Properties->Description = "Description"; requestData->SetText(L"Test message"); requestData->SetStorageItems(dynamic_cast<IIterable<IStorageItem^>^>(storageItems)); }
Thanks,
Anil.S- Merged by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, September 6, 2012 4:02 PM duplicate post
Thursday, September 6, 2012 10:22 AM -
The purpose of the share contract is to let the user choose to share to anybody through any share target. The app cannot control which share target or contact is used. If your goal is to send to a specific address rather than to provide data for the user to share as the user wants then you can't use the share contract; you may be better off launching a mailto: protocol or connecting to a specific web service.
It is up to the share target to pick which ones it will use and how to use them. The base OS supports all of the types represented in the DataRequest plus custom types, but individual share targets will only support the ones which are relevant to them.
--Rob
- Marked as answer by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, October 25, 2012 12:03 AM
Thursday, September 6, 2012 4:01 PMModerator -
Rob, Thanks for your reply & I need to send attachment along with mail, so launching url "mailto" not possible i think. Please Help
- Edited by AnilKumar.S Monday, September 10, 2012 10:49 AM Very Urgent
Friday, September 7, 2012 3:27 AM