Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Microsoft.Outlook jacob-1.17-M2-x86.dll

 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

How to create contact card in Outlook via jacob-1.17-M2-x86.dll
Have been trying combination of below commands, but no success, for now http://www.land-of-kain.de/docs/jacob/

Any idea?

Regards
 
Mark Beardsley
Ranch Hand
Posts: 32
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Libraries such as Jacob really allow you to 'translate' the VBA code used to create macros into Java. So, first take a look here - http://msdn.microsoft.com/en-us/library/office/aa210907%28v=office.11%29.aspx - and scroll down to the VBA example which looks like this;

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olContactItem)

This tells you that to crate a new contact, you need an object that refers to the Outlook application and then call the CreateItem() method on this object passing it the correct value to yield a new contact. This value is 2 I think but you can find out by digging around in the Oulook Object Model.

If I have the time, I will try to put together the Jacob code but cannot promise qwhen this will be.
 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark, although the offer is generous, please DontBeACodeMill. If you provide full answers, Imre will not learn a thing.
 
Mark Beardsley
Ranch Hand
Posts: 32
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK Rob, I understand. I only meant to infer that I would be testing my hypotheses to ensure it was correct. Not wishing to sound boastful, but it was and the simple example I was going to post was this;

public class OutlookTest {

private ActiveXComponent oleComponent = null;
private Dispatch activeDoc = null;

private final static String APP_ID = "Outlook.Application.12";

public OutlookTest(boolean visibility) {
//this.oleComponent = ActiveXComponent.connectToActiveInstance(OutlookTest.APP_ID);
this.oleComponent = new ActiveXComponent(OutlookTest.APP_ID);
//this.oleComponent.setProperty("Visible", new Variant(visibility));
}

public void createContact() {
Dispatch disp = null;
Variant var = null;
Object[] args = null;

args = new Object[]{2};
var = Dispatch.call(this.oleComponent, "CreateItem", args);
System.out.println(var);

disp = var.getDispatch();

Dispatch.put(disp, "FullName", "Contact's Full Name");
Dispatch.put(disp, "CompanyName", "Company Name.");
Dispatch.put(disp, "JobTitle", "The Boss");
// Show the contact for de-bugging purposes.
Dispatch.call(disp, "Display");
}

/**
* Called once processing has completed in order to close down the instance
* of Word.
*/
public void quit() {
Dispatch.call(this.oleComponent, "Quit");
this.oleComponent.safeRelease();
}
}

The other members, properties, etc of the ContactItem can be read from here - http://msdn.microsoft.com/en-us/library/office/ff868407.aspx
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic