开发者

Want to disconnect or delete PST from Outlook with Jacob jar

I am using Jacob jar file to save msg. To connect the pst i am using the below code:

ActiveXComponent ol = new ActiveXComponent("Outlook.Application");
if (ol != null) {
    try {
        System.out.println("try block....");
        Dispatch olo = ol.getObject()开发者_开发百科;
        Dispatch myNamespace = Dispatch.call(olo, "GetNamespace","MAPI").toDispatch();
        Variant varNewStore = Dispatch.call(myNamespace, "AddStore",strPSTPath);
        Dispatch disAllFolders = Dispatch.call(myNamespace, "Folders").toDispatch();
        Dispatch oRootFolder = Dispatch.call(disAllFolders, "GetLast").toDispatch();
        Dispatch innerFolder = Dispatch.call(oRootFolder, "Folders","Inbox").toDispatch();
        Dispatch items = Dispatch.call(innerFolder, "Items").toDispatch()
    }
}

Now i want to delete or disconnect PST file from Outlook plz suggest me how can i achieve this functionality.

Regards, Kashif


Kashif:

I don't program in Java, but I'm learning JABACO (Java To Basic Compiler) and I'm using the excellent JACOB.

In the JACOB FAQ [ http://danadler.com/jacob/jacobfaq.html ], I found this:

Hey, my Excel and/or Word process still remain, also after the Java program terminates!

Try calling ComThread.release() when you’re finished. See http://groups.yahoo.com/group/jacob-project/message/1425

I hope that I have helped.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜