0

I wanted to share some data as mail from my UWP application, but I am unable to change the title (subject of the email), as I am able set title from code but not showing in outlook subject, outlook is using its default subject line as "Text from $SystemsUserName".

    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
            dataTransferManager.DataRequested += DataTransferManager_DataRequested;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DataTransferManager.ShowShareUI();
        }
        void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
        {
            DataRequest request = args.Request;
            request.Data.Properties.Title = "My Custom Subject"; // This is showing as "Text from $SystemsUserName" in the Outlook mail.
            request.Data.SetText("This is body of email");

        }
    }

in xaml part of this page only one button is there which calls "Button_Click" this code shows outlook email window but does not show subject in the mail .

I read the documents on DataRequest but did not find anything regarding this issue. and also, there is no question regarding this anywhere.

4
  • To help us further check the problem for you, could you please tell us the version of Outlook and the system? Commented Apr 12, 2024 at 10:03
  • I have Microsoft Outlook Version 1.2024.403.300 (Production). Commented Apr 12, 2024 at 14:24
  • When I use Outlook, there is no title option in the window. When I use Mail, the title appears. Why not use Windows.ApplicationModel.Email to send email? Commented Apr 15, 2024 at 7:31
  • I also checked with Mail its working properly in Mail. Commented Apr 15, 2024 at 8:28

1 Answer 1

0

Its Problem with Microsoft Outlook as it overwrites the Subject, and with Microsoft Mail it works fine. The code is right, the bug is in Microsoft Outlook.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.