Код: Выделить всё
You have Microsoft Outlook Version 1.2024.1009.100 (Production).
Client Version is 20241018004.16.
WebView2 Version is 130.0.2849.52.
< /code>
Когда я получаю почту с вложением, я хочу перетащить это вложение непосредственно в приложение для моего приложения Windows Forms для дальнейшей обработки.public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void Form1_DragDrop(object sender, DragEventArgs e)
{
string[] formatStrings = e.Data.GetFormats(autoConvert: true);
foreach (string formatString in formatStrings)
{
object dataObject = e.Data.GetData(formatString, autoConvert: true);
if (dataObject is null)
{
Debug.WriteLine($"{formatString} is null.");
}
else
{
MemoryStream memoryStream = (MemoryStream)dataObject;
string fileName = string.Join("_", formatString.Split(Path.GetInvalidFileNameChars()));
string tempPath = Path.Combine(@"C:\temp", fileName);
using (FileStream fileStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write))
{
memoryStream.CopyTo(fileStream);
}
Debug.WriteLine($"Saved file {tempPath}");
}
}
}
}
Выход программы:
.
Код: Выделить всё
Saved file C:\temp\DragContext
Saved file C:\temp\DragImageBits
Saved file C:\temp\chromium_x-renderer-taint
FileDrop is null.
FileNameW is null.
FileName is null.
Saved file C:\temp\FileGroupDescriptorW
FileContents is null.
Saved file C:\temp\Chromium Web Custom MIME Data Format
< /code>
Я и ожидал бы, что файл сохранен размером 10 МБ, так как вложение, которое я использовал для тестирования, является таким большим. Файл DragimageBits Подробнее здесь: https://stackoverflow.com/questions/791 ... ation-in-n
Мобильная версия