User Tools

Site Tools


notes:uwp:internet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
notes:uwp:internet [2017/06/06]
leszek
notes:uwp:internet [2017/06/06]
leszek
Line 23: Line 23:
 using Windows.Storage.Streams;​ using Windows.Storage.Streams;​
 ... ...
-public async Task SendEmail(string recipientEmail,​ StorageFile ​attachmentFile)+public async Task SendEmail(string recipientEmail,​ StorageFile ​fileAttachment)
 { {
     // Create an EmailMessage object. It is located in the Windows.ApplicationModel.Email namespace.     // Create an EmailMessage object. It is located in the Windows.ApplicationModel.Email namespace.
Line 33: Line 33:
  
     // Create a file attachment. ​     // Create a file attachment. ​
-    var stream = RandomAccessStreamReference.CreateFromFile(attachmentFile); +    var stream = RandomAccessStreamReference.CreateFromFile(fileAttachment); 
-    var attachment = new EmailAttachment(attachmentFile.Name, stream);+    var attachment = new EmailAttachment(fileAttachment.Name, stream);
     email.Attachments.Add(attachment);​     email.Attachments.Add(attachment);​
  
Line 44: Line 44:
 } }
 ... ...
-// Obtain the attachment ​file.  ​+// Obtain the file attachment.  ​
 var localFolder = ApplicationData.Current.LocalFolder;​ var localFolder = ApplicationData.Current.LocalFolder;​
 string path = System.IO.Path.Combine(localFolder.Path,​ "​test.txt"​);​ string path = System.IO.Path.Combine(localFolder.Path,​ "​test.txt"​);​
Line 53: Line 53:
 </​code>​ </​code>​
  
 +MSDN: [[https://​docs.microsoft.com/​en-us/​windows/​uwp/​contacts-and-calendar/​sending-email|Constructing and sending emails]]
notes/uwp/internet.txt · Last modified: 2017/06/06 by leszek