If I understand correctly you want to save the attachement somewhere? EWS provides you a byte array for every file stored within Content property of FileAttachment object, and from there its extremely easy to do so:
foreach (var a in mail.Attachments)
{
FileAttachment fa = a as FileAttachment;
if(fa != null)
{
try
{
//if you don't call this the Content property may be null,
//depending on your property loading policy with EWS
fa.Load();
}
catch
{
continue;
}
using(FileStream fs = System.IO.File.OpenWrite("path_to_file"))
{
fs.Write(fa.Content, 0, fa.Content.Length);
}
}
}
If you just want a Stream object to do something else with it just create a MemoryStream:
MemoryStream ms = new MemoryStream(fa.Content);