Код: Выделить всё
You have Microsoft Outlook Version 1.2024.1009.100 (Production).
Client Version is 20241018004.16.
WebView2 Version is 130.0.2849.52.
На данный момент Я попытался сохранить вложение в виде файла, используя следующий код:
Код: Выделить всё
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}");
}
}
}
}
[img]https://i.sstatic.net /oBDDEKA4.png[/img]
Вывод программы:
Код: Выделить всё
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
Многие решения, которые я нашел в Интернете, используют метод GetData и FileContents для получения данных вложения и сохранения файла, но в моем приложении GetData просто возвращает значение null . Что-то изменилось в новой версии Outlook? Требуется ли какая-то ручная работа с использованием COM-объектов, OleConverters, IntPtr или чего-то еще? К сожалению, я почти не знаком с этими темами и буду признателен за подсказки.
Подробнее здесь: https://stackoverflow.com/questions/791 ... ation-in-n
Мобильная версия