Jeg har fundet denne lille ting på msdn
import com.ms.com.*;
//import msoutl85.*; //In order to use Outlook Object Model
import msoutl9.*;
public class Class1
{
public static void main(String[] args)
{
try
{ // Start from the application
_Application olApp = (_Application) new Application();
// Get MAPI infostore
_NameSpace mapiNS = olApp.GetNamespace(\"MAPI\");
// Create a null Parameter for later use
Variant nullParam = new Variant();
nullParam.noParam();
// Open the Outbox
MAPIFolder outbox = (MAPIFolder)mapiNS.GetDefaultFolder(
OlDefaultFolders.olFolderOutbox);
// Create a new message
_MailItem newMsg = (_MailItem)outbox.getItems().Add(nullParam);
// Set the subject
newMsg.setSubject(\"This is message from Jave!\");
// Set the body
newMsg.setBody(\"How are you doing today!\");
//Create an attachment, we need to do some preparation
// Get the source for the attachment
Variant source = new Variant();
// TODO: you may change the file path
source.putString(\"C:\\\\Autoexec.bat\");
// TODO: you may change the DisplayName
Variant displayName = new Variant();
displayName.putString(\"Autoexec.bat\");
// Specify the type of the attachment
Variant type = new Variant();
type.putInt(OlAttachmentType.olByValue);
// Decide where you want to put the attachment
Variant position = new Variant();
position.putFloat(1000);
// It is time to really create the attachment
Attachment attachment = (Attachment) newMsg.getAttachments().Add(source, type, position, displayName);
// Create a Recipient
// TO DO: change to your recipient\'s name!
Recipient recipient = (Recipient) newMsg.getRecipients().Add( \"Morten@skovborg.dk\");
// Set type to the recipient
recipient.setType(OlMailRecipientType.olTo);
// Resolve the recipient
recipient.getResolved();
// Send the new message
newMsg.Send();
// Clean up
olApp = null;
mapiNS = null;
outbox = null;
newMsg = null;
recipient = null;
attachment = null;
}
catch(java.lang.Exception e)
{
System.out.println( \"Failed!\" );
e.printStackTrace();
}
System.out.println(\"Program is terminated\");
}
}
her er linket til stedet :
http://support.microsoft.com/support/kb/articles/Q216/7/28.ASP?LN=EN-US&SD=gn&FR=0&qry=java%20outlook&rnk=9&src=DHCS_MSPSS_gn_SRCH&SPR=OUTder skal dog rettes lidt i det da der på den linje i toppen hvor der står : NameSpace mapiNS = olApp.GetNamespace(\"MAPI\");
skal stå : _NameSpace mapiNS = olApp.GetNamespace(\"MAPI\");
men hvad kan man for vente af microsoft
vi ses og tak for hjælpen selv om det ikke var det jeg ledte efter men jeg har lært af det
Med venlig hilsen
Morten skovborg