Results 1 to 2 of 2
  1. #1
    ollyworks is offline Member
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Unhappy incompatible types...What is "Dispatch" ?

    Hi,

    I am trying to make an applet retrieving MS Outlook Addresses book using a package I found on google called "Jacob". You can see the last 2 import statements at the top of the applet code below.

    I need your help to make the Applet source code to work fine since I am really a newbie coding in Java. Right now I'm getting the following error when compiling with "javac":

    Java Code:
     
    ContactImporter_V1.java:20: incompatible types
    found : java.lang.Object
    required: com.jacob.com.Dispatch
                                      Dispatch olo = olo.getObject();
    with the cursor right below "olo.getObject()"

    Do you have any idea of what it could be ? Is there someone to test it with me ?.....

    Java Code:
     
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    import com.jacob.activeX.*;
    import com.jacob.com.*;
     
    	public class ContactImporter_V1 extends java.applet.Applet {
     
    		public void paint(java.awt.Graphics contexteGraphique){
    			contexteGraphique.drawString("Chargement de votre carnet d'adresses MS Outlook...Veuillez patienter! :)", 70, 40);
    			final int olFolderContacts = 10;
     
    			ActiveXComponent ol = new ActiveXComponent("Outlook.Application");
    			Dispatch dsp = new Dispatch();
     
    			Dispatch olo = ol.getObject();
    			Dispatch myNamespace = Dispatch.call(olo, "GetNamespace","MAPI").toDispatch();
    			Dispatch myFolder = Dispatch.call(myNamespace, "GetDefaultFolder",new Integer(olFolderContacts)).toDispatch();
     
    			Dispatch items = Dispatch.get(myFolder, "Items").toDispatch();
     
    			int count = Dispatch.call(items, "Count").toInt();
     
    			for (int i = 1; i <= count; i++)
    			{
    				Dispatch item;
    				String fullName = Dispatch.get(item, "Fullname").toString();
    				String emailAddress = Dispatch.get(item, "Email1Address").toString();
    				printField("Email:", emailAddress);
    			}
    		}
     
    		public static void printField(String label, String value)
    		 {
    			if (value.length() != 0)
    			 {
    				System.out.println(label + " " + value);
    			}
    		}
     
     
    	}
    Attached Thumbnails Attached Thumbnails incompatible types...What is &quot;Dispatch&quot; ?-javac_2.jpg   incompatible types...What is &quot;Dispatch&quot; ?-javac_3.jpg  
    Last edited by ollyworks; 09-10-2009 at 02:39 AM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 03:03 AM
  2. getDisplayLanguage returns "en" not "English"
    By DD70 in forum New To Java
    Replies: 6
    Last Post: 08-12-2009, 11:22 PM
  3. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  4. Replies: 1
    Last Post: 10-20-2008, 07:35 AM
  5. "Jumble" or "Scramble" Program
    By Shadow22202 in forum Java Applets
    Replies: 8
    Last Post: 04-30-2008, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •