Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » OLE Outlook
OLE Outlook [message #449590] Wed, 26 January 2005 19:45 Go to next message
Kalman Hazins is currently offline Kalman HazinsFriend
Messages: 76
Registered: July 2009
Member
I am trying to talk to Microsoft Outlook from SWT. (What I really need to do
is access the AddressBook.) I was able to embed a Word document into my
application, but when I use the same technique for Outlook - it fails.

The code below:

OleFrame frame = new OleFrame (shell, SWT.NONE);
OleControlSite site = new OleControlSite (frame, SWT.NONE,
"Outlook.Application");
site.doVerb (OLE.OLEIVERB_UIACTIVATE);
OleAutomation outlook = new OleAutomation(site);

only works when Outlook is already open. If Outlook is not open - I get the
following EXCEPTION:

Exception in thread "main" java.lang.NullPointerException
at org.eclipse.swt.ole.win32.OleAutomation.<init>(OleAutomation.java:114)
at Outlook.main(Outlook.java:29)


Any ideas on how to avoid this? (It's a weird requirement to have the
customer open Outlook before running the program.)

Thanx,
- Kalman
Re: OLE Outlook [message #449799 is a reply to message #449590] Sat, 29 January 2005 22:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gilblais.yahoo.com

Kalman - Why not open Outlook yourself if you get an exception?
"Kalman" <kalman@zikal.com> wrote in message
news:ct8rt6$q1r$1@www.eclipse.org...
>I am trying to talk to Microsoft Outlook from SWT. (What I really need to
>do
> is access the AddressBook.) I was able to embed a Word document into my
> application, but when I use the same technique for Outlook - it fails.
>
> The code below:
>
> OleFrame frame = new OleFrame (shell, SWT.NONE);
> OleControlSite site = new OleControlSite (frame, SWT.NONE,
> "Outlook.Application");
> site.doVerb (OLE.OLEIVERB_UIACTIVATE);
> OleAutomation outlook = new OleAutomation(site);
>
> only works when Outlook is already open. If Outlook is not open - I get
> the
> following EXCEPTION:
>
> Exception in thread "main" java.lang.NullPointerException
> at org.eclipse.swt.ole.win32.OleAutomation.<init>(OleAutomation.java:114)
> at Outlook.main(Outlook.java:29)
>
>
> Any ideas on how to avoid this? (It's a weird requirement to have the
> customer open Outlook before running the program.)
>
> Thanx,
> - Kalman
>
>
Re: OLE Outlook [message #1027275 is a reply to message #449590] Tue, 26 March 2013 19:54 Go to previous message
Binko Binev is currently offline Binko BinevFriend
Messages: 20
Registered: June 2012
Junior Member
Hi,
Sorry for disturbing you but may be you have ideas how my problem can be solved.
I saw that you have worked with OLE and may be you know the solution of my problem.

the problem is the following. I have an embedded Word document and I process the rows of a table in the document.

Sometimes it works, but sometimes the whole word application crashes.

This is the method where i get the row


/**
	 * Returns the row in the table with the given index
	 * @param tableVar - table variant
	 * @param rowIndex - row index
	 * @return rowVariant - row Variant
	 * @throws OleException
	 */
	public static Variant getRow(Variant tableVar, int rowIndex) throws OleException {
		OleAutomation tableAuto = tableAuto = tableVar.getAutomation();
		OleUtils.printAutomation(tableAuto);
		Variant rowsVar = null;
		while (rowsVar == null){
			rowsVar = tableAuto.getProperty(101/*Rows*/);
		}
		OleAutomation rowsAuto = rowsVar.getAutomation();
		Variant rowVar = rowsAuto.invoke(0/*Item*/, new Variant[]{new Variant(rowIndex)});
		return rowVar;
	}



Sometimes the method crashes and returns rowsvar as null.
How can I sove this problem? Any ideas?
Previous Topic: NoSuchMethodError: org.eclipse.swt.internal.ole.win32.COM
Next Topic:About disposing ressources
Goto Forum:
  


Current Time: Fri Apr 19 02:23:44 GMT 2024

Powered by FUDForum. Page generated in 0.02342 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top