在Outlook中读取PST文件并获取信息 [英] reading PST file in outlook and get information
问题描述
我写了以下代码来获取pst信息,但我没有给出任何结果,也没有错误
使用系统;
使用System.Collections.Generic;
使用System.ComponentModel;
使用System.Data;
使用System.Drawing;
使用System.Linq;
使用System.Text;
使用System.Windows.Forms;
使用OutLook = Microsoft.Office.Interop.Outlook;
命名空间reading_past_file
{
公共局部类Form1:Form
{
公共Form1()
{
InitializeComponent();
}
私有无效btnCheck_Click(对象发送者,EventArgs e)
{
OutLook._Application OutlookObj =新的OutLook.Application();
OutLook.MAPIFolder fldMail =(OutLook.MAPIFolder)OutlookObj.Session.GetDefaultFolder(OutLook.OlDefaultFolders.olFolderInbox);
OutLook.MailItem newMail =(OutLook.MailItem)fldMail.Items.Add(OutLook.OlItemType.olMailItem);
}
}
}
让我告诉你我想做什么
我需要做的是阅读MAPI文件夹中的未读恶意软件,并为我的开发获取SenderName SenderAddress正文和附件内容,我对Introp类确实不太了解.
I wrote following code for get pst information but i didn''t give any out put also it dosen''t have errors
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OutLook = Microsoft.Office.Interop.Outlook;
namespace reading_past_file
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnCheck_Click(object sender, EventArgs e)
{
OutLook._Application OutlookObj = new OutLook.Application();
OutLook.MAPIFolder fldMail = (OutLook.MAPIFolder)OutlookObj.Session.GetDefaultFolder(OutLook.OlDefaultFolders.olFolderInbox);
OutLook.MailItem newMail = (OutLook.MailItem)fldMail.Items.Add(OutLook.OlItemType.olMailItem);
}
}
}
let me tell u what i want to do
I need to do I need to read Unread emils in MAPI folder and get SenderName SenderAddress Body and Attachment content for my development I don''t really have good idea about Introp classes
推荐答案
看看这篇文章:
导入和导出Outlook约会(使用JavaScript) [
Have a look at this article:
Import and Export Outlook Appointments (using JavaScript)[^]
This is done for webapplication. You will get an idea of what needs to be done. You need to write similar code in code-behind for desktop application.
基于您的 ^ ],您要阅读而不是写!
Based on your last question[^], you want to read it and not write!
newContact.Email1Address = textBox1.Text.Trim().ToString();
newContact.Email1Address= textBox1.Text.Trim().ToString();
当前代码将创建一个联系人,仅此而已.
您是否要做其他事情?
Current code will create a contact and thats it.
Were you trying to do something else?
这篇关于在Outlook中读取PST文件并获取信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!