locked
How to Share File to specific receiver email address

    Question

  • I'm develop a windows store app using winRT C++. I can share a file through email but it cannot specific a receiver email address. Bellow is a part of my code to sharing a file:-

    DataRequest^ request = e->Request;
    request->Data->Properties->Title = "Testing";
    request->Data->Properties->Description = "Email With Attachment";
    
    DataRequestDeferral^ deferral = request->GetDeferral();
    create_task(Windows::ApplicationModel::Package::Current->InstalledLocation->GetFileAsync("testing.pdf")).then([this, request, deferral](task<StorageFile^> getFileTask)
    {
        try
        {
            auto pdfFile = getFileTask.get();
            auto storageItems = ref new Platform::Collections::Vector<IStorageItem^>();
            storageItems->Append(pdfFile);
            request->Data->SetStorageItems(storageItems);
            deferral->Complete();
        }
        catch (Exception^ ex)
        {
            // Calling FailWithDisplayText() also calls Complete on the deferral.
            request->FailWithDisplayText(ex->Message);
        }
    });

    How can I send the attachment file to a specific email receiver without fill in the email address manually.

    Sunday, January 25, 2015 8:18 AM

Answers

  • Hi Tonberry,

    Based on my knowledge, you are using the correct way to share files in windows store app. The share app provides some frequent Contacts as the following image. But there is no options to set the recipients programmatically. If you want this feature, I would recommend you feature a request on UserVoice.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, February 9, 2015 7:45 AM
    Moderator

All replies

  • Hello Tonberry89,

    i think you are not able to set the emails receiver address with your code, because this is is a task for the sharing-application (e.g. Mail-App). 

    The user needs to enter such email-addresses. 

    Or you can activate the Email-programm with the UriLauncher-class using the protocoll mailto:


    © 2015 Thomas Roskop

    Germany // Deutschland

    Sunday, January 25, 2015 8:31 AM
  • why it not allow us to do both action? if I using mailto it is not allow me to attach a file. Is it possible have any method that I can do both action?



    • Edited by Tonberry89 Sunday, January 25, 2015 8:42 AM
    Sunday, January 25, 2015 8:36 AM
  • Hi Tonberry,

    Based on my knowledge, you are using the correct way to share files in windows store app. The share app provides some frequent Contacts as the following image. But there is no options to set the recipients programmatically. If you want this feature, I would recommend you feature a request on UserVoice.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, February 9, 2015 7:45 AM
    Moderator
  • May I ask base on above code how can I add signature inside my email content? As an example I want to add company icon on top of the email contents.
    Friday, February 13, 2015 10:32 AM