在 vb.net 或 c# 中从 Web 应用程序打开特定的 Outlook 消息
Open a specific outlook message from a web app in vb.net or c#
在网络应用程序中,我必须提供与图中类似的当前用户电子邮件帐户的电子邮件列表。
Action Date Sender Subject
------ --------------- ------------------------ ------------
view 1/6/21 10.25 AM jhon.doe@abc.com Red paint
view 1/6/21 12.00 AM Mr. Green pink Car
view 1/6/21 3.38 PM abcdef.1234@aabb.eu little funny dog
view 1/7/21 12.00 AM europe.america@terra.com Holiday
列表可以按发件人或部分主题或两者进行过滤。当用户点击一条消息时,它必须在 outlook 中打开。
Microsoft.Office.Interop.Outlook 还是 EWS?在哪里可以找到 C# 或 vb.net 中的一些示例? TIA
您可以尝试使用以下代码来过滤电子邮件并在 asp.net 网络应用程序的 outlook 中打开它。
using Outlook = Microsoft.Office.Interop.Outlook;
Outlook.Application myApp = new Outlook.Application();
Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
Outlook.MAPIFolder myInbox = mapiNameSpace.Folders["Senderemail"].Folders["somefolder"];
Outlook.MailItem item1 =(Outlook.MailItem) myInbox.Items.Cast<Outlook.MailItem>().Where(i=> (i.Subject == "subjectname") && (i.CreationTime==DateTime.Parse("Dateime"))).FirstOrDefault();
item1.Display(true);
item.Display(true)
方法用于在outlook中打开邮件项
从 Web 应用程序自动化任何 Office 应用程序并不是一个好主意。您不能在最终用户机器上自动化 Office 应用程序,所有自动化都将在服务器服务器上进行,我认为这并不是您真正需要的。以下是 MS 对此的说明:
Microsoft strongly recommends that developers find alternatives to Automation of Office if they need to develop server-side solutions. Because of the limitations to Office's design, changes to Office configuration are not enough to resolve all issues. Microsoft strongly recommends a number of alternatives that do not require Office to be installed server-side, and that can perform most common tasks more efficiently and more quickly than Automation. Before you involve Office as a server-side component in your project, consider alternatives.
在 Considerations for server-side Automation of Office 文章中阅读更多相关信息。
如果您只在 Outlook 中处理 Exchange 配置文件,您可以考虑使用 Exchange Web 服务或任何其他 APIs,例如 Graph API。有关详细信息,请参阅 Explore the EWS Managed API, EWS, and web services in Exchange。
在网络应用程序中,我必须提供与图中类似的当前用户电子邮件帐户的电子邮件列表。
Action Date Sender Subject
------ --------------- ------------------------ ------------
view 1/6/21 10.25 AM jhon.doe@abc.com Red paint
view 1/6/21 12.00 AM Mr. Green pink Car
view 1/6/21 3.38 PM abcdef.1234@aabb.eu little funny dog
view 1/7/21 12.00 AM europe.america@terra.com Holiday
列表可以按发件人或部分主题或两者进行过滤。当用户点击一条消息时,它必须在 outlook 中打开。
Microsoft.Office.Interop.Outlook 还是 EWS?在哪里可以找到 C# 或 vb.net 中的一些示例? TIA
您可以尝试使用以下代码来过滤电子邮件并在 asp.net 网络应用程序的 outlook 中打开它。
using Outlook = Microsoft.Office.Interop.Outlook;
Outlook.Application myApp = new Outlook.Application();
Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
Outlook.MAPIFolder myInbox = mapiNameSpace.Folders["Senderemail"].Folders["somefolder"];
Outlook.MailItem item1 =(Outlook.MailItem) myInbox.Items.Cast<Outlook.MailItem>().Where(i=> (i.Subject == "subjectname") && (i.CreationTime==DateTime.Parse("Dateime"))).FirstOrDefault();
item1.Display(true);
item.Display(true)
方法用于在outlook中打开邮件项
从 Web 应用程序自动化任何 Office 应用程序并不是一个好主意。您不能在最终用户机器上自动化 Office 应用程序,所有自动化都将在服务器服务器上进行,我认为这并不是您真正需要的。以下是 MS 对此的说明:
Microsoft strongly recommends that developers find alternatives to Automation of Office if they need to develop server-side solutions. Because of the limitations to Office's design, changes to Office configuration are not enough to resolve all issues. Microsoft strongly recommends a number of alternatives that do not require Office to be installed server-side, and that can perform most common tasks more efficiently and more quickly than Automation. Before you involve Office as a server-side component in your project, consider alternatives.
在 Considerations for server-side Automation of Office 文章中阅读更多相关信息。
如果您只在 Outlook 中处理 Exchange 配置文件,您可以考虑使用 Exchange Web 服务或任何其他 APIs,例如 Graph API。有关详细信息,请参阅 Explore the EWS Managed API, EWS, and web services in Exchange。