title image


Smiley Re: JAVA und Outlook
Nimm dafür eine Java - COM Bridge:



http://danadler.com/jacob/



und dann die Kontakte auslesen:









package Activex01;



import com.jacob.activeX.*;

import com.jacob.com.*;



public class getContacts {

public static void main(String[] args) {

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();



//nächste zeile Fehlermeldung



Dispatch items = Dispatch.get(myFolder, "Items").toDispatch();



int count = Dispatch.call(items, "Count").toInt();



for (int i = 1; i <= count; i++) {

Dispatch item;

item = Dispatch.call(items, "Item", new Integer(i)).toDispatch();



String fullName = Dispatch.get(item, "Fullname").toString();

String emailAddress = Dispatch.get(item, "Email1Address").toString();

String addressStreet = Dispatch.get(item, "BusinessAddressStreet")

.toString();

String addressCity = Dispatch.get(item, "BusinessAddressCity")

.toString();

String addressCountry = Dispatch.get(item, "BusinessAddressCountry")

.toString();

String addressPostalCode = Dispatch.get(item,

"BusinessAddressPostalCode").toString();

String addressState = Dispatch.get(item, "BusinessAddressState")

.toString();

String title = Dispatch.get(item, "Title").toString();

String phone = Dispatch.get(item, "BusinessTelephoneNumber")

.toString();

String fax = Dispatch.get(item, "BusinessFaxNumber").toString();



printField("", fullName);

printField("", title);

printField("", addressStreet);

printField("", addressCity);

printField("", addressState);

printField("", addressPostalCode);

printField("", addressCountry);

printField("Tel:", phone);

printField("Fax:", fax);

printField("Email:", emailAddress);



System.out.println();



}

}



public static void printField(String label, String value) {

if (value.length() != 0) {

System.out.println(label + " " + value);



(Ist nicht von mir! kommt von hier: http://groups.google.de/group/comp.lang.java.programmer/browse_thread/thread/4de4d1ff59d055cf/20cd38bd279e6a6f?lnk=st&q=java+outlook+contacts&rnum=3&hl=de#20cd38bd279e6a6f)



Und dann mit der Java MailAPI verschicken:



http://java.sun.com/products/javamail/

http://www.programmers-corner.com/sourcecode/147



ciao



morphisto





geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: