Я хочу получить emailId отправителя.
Я могу прочитать все данные календаря по указанному ниже коду, но не по emailId отправителя.
using Microsoft.Office.Interop.Outlook;
Microsoft.Office.Interop.Outlook.Application outlook = new Application();
Microsoft.Office.Interop.Outlook.NameSpace oNS = outlook.GetNamespace("MAPI");
oNS.Logon(Missing.Value, Missing.Value, true, true);
string currentUserEmail = oNS.CurrentUser.Address;
string currentUserName = oNS.CurrentUser.Name;
// Get the Calendar folder.
Microsoft.Office.Interop.Outlook.MAPIFolder objMAPIFolder =oNS.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
//Get the Sent folder
MAPIFolder sentFolder = oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderSentMail);
Items sentMailItems = sentFolder.Items;
Items items = objMAPIFolder.Items;
foreach (object item in sentMailItems)
{
if (item is MailItem)
{
MailItem oneMail = item as MailItem;
string mailContent = oneMail.HTMLBody;
//item.sender is not available
}
}
foreach (object item in items)
{
if (item is Microsoft.Office.Interop.Outlook.AppointmentItem)
{
Microsoft.Office.Interop.Outlook.AppointmentItem mitem = item as Microsoft.Office.Interop.Outlook.AppointmentItem;
string subject = mitem.Subject;
DateTime start = mitem.Start;
DateTime end = mitem.End;
string body = mitem.Body;
string location = mitem.Location;
string entryId = mitem.EntryID;
//sender email id not available
//string senderEmail = mitem.sender;
}
}
oNS.Logoff();
Но в любом случае, неважно, читаете ли вы встречи или отправляете электронные письма из папок, я не могу получить идентификатор электронной почты отправителя.
есть ли у кого-нибудь решение этой проблемы?