Application myApp = new ApplicationClass();
                NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
// 这个出错               
 MAPIFolder folder = mapiNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);很奇怪,在本地都是好的,但是发布到server win2003的时候就有问题。error如下:2009-04-15 03:42:14,656 [2532] ERROR ReadMail._Default [(null)] - System.Runtime.InteropServices.COMException (0x9AC40111): ?????? C:\Documents and Settings\Echo\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst,???????????????????????,???????
   at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Folders()
   at ReadMail._Default.Button1_Click(Object sender, EventArgs e)

解决方案 »

  1.   

    Hi  For the above issue check the following things in macine.config change impersonate= true, if false or if true change to false username="system"  in IIS for windows server 2003 select the account as NETWORK SERVICE, instead of ASPNET/IUSR. In DCOMCONFIG change identity as The interactive User. In Windows Services select IISADMIN select properties and under Log On tab  check Allow service to Interact with Desktop. Also for the particular directory give all the rights. I am using XP, and I am able to do mail merge without any Issues, Initially I was also facing same problem, after incorporating above things everything is working fine. with regardsRajeeva.G
      

  2.   

    hi, ppfaqThanks.But still doesn't work, I already have created the "identity impersonate="true" userName="Echo" password="jcl" />". Now I change the  userName to System you have told, but there are server error with. So I have to redo my sourcode brfore.I have the winXP to make the sourcode, and release to Win2003 server.Could you please help me out the issue?Best regards.Echo
      

  3.   

    hi, ppfaq,1,Where can I set the configration as follows.in IIS for windows server 2003 select the account as NETWORK SERVICE, instead of ASPNET/IUSR. 
    In DCOMCONFIG change identity as The interactive User. Please helpThank you.Echo
      

  4.   

    在com组件里配置outlook操作权限。添加net work,net services
      

  5.   

    1. start->run: dcomcnfg
    2. 
    3.If this still does not work, then 
    start->run: eventvwr
    Check the log entries under category 'system'
      

  6.   

    to:cppfaq,wuyq11 2位是过去了,但是有个问题啊,在程序读取outlook的时候,怎么打不开outlook了啊。error:
    说默认的文件夹被占用。。请教一下:
    1,如果要读取outlook的mail,server上的outlook要运行吗?如果不打开运行,mail是不是不会收到?因为我在本地都是打开的,我的理解是outlook打开。自动收mail,然后程序解析这些已经收到的mail。
    2,还是直接在程序中直接收发outlook的mail呢?不是了解,今天刚刚开始熟悉,您们有代码让我参考一下吗?