From: "Dwayne Smurdon @ DNA Media Pro" Date: 2003-01-26T18:15:21+09:00 Subject: Adding a ContactItem to a Contact Folder. This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C2C4F1.0CD25AB0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Ok, I'm new to Ruby and new to Office Objects -- double whammy. I'm simply trying to add a new Contact item to the default contact folder. This is my baby step. In the long run I have a database of over 100,000 Contacts I need to dump into Outlook. I thought this would be a good application for Ruby. I'm having trouble though. require 'win32ole' outlook = WIN32OLE.new("outlook.application") oNameSpace = outlook.getNameSpace('MAPI'); contactFolder = oNameSpace.GetDefaultFolder(10) contact = outlook.CreateItem(2) contact.lastName = "Bar" contact.firstName = "Foo" contact.homeTelephoneNumber = "703-333-3456" I thought I should be able to do contactFolder.Add(contact) # OR items = conact.Items items.Add(contact) I keep getting the missing_method error on the Add function. I have tried a lot of other things, which did not work. So, this is where I am now. If I remove the line with items.Add or contactFolder.Add -- i get no errors. Any help would be appreciated. Also, I have found the Office Object Models on MSDN -- this is a huge help, but if there are good examples of Outlook automation, that would be great. (well, great if they are in Ruby, good if they are in VB, which is likely. :) ------=_NextPart_000_0008_01C2C4F1.0CD25AB0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Adding a ContactItem to a Contact Folder.

Ok,  I'm new to Ruby and new to Office Objects -- = double whammy.  I'm simply trying to add a new Contact item to the = default contact folder.  This is my baby step.  In the long = run I have a database of over 100,000 Contacts I need to dump into = Outlook.  I thought this would be a good application for = Ruby.  I'm having trouble though.


  require 'win32ole'
  outlook =3D = WIN32OLE.new("outlook.application")
  oNameSpace =3D = outlook.getNameSpace('MAPI');
  contactFolder =3D = oNameSpace.GetDefaultFolder(10)

  contact =3D outlook.CreateItem(2)
  contact.lastName =3D "Bar"
  contact.firstName =3D "Foo"
  contact.homeTelephoneNumber =3D = "703-333-3456"

I thought I should be able to do
  contactFolder.Add(contact)  # OR
  items =3D conact.Items
  items.Add(contact)

I keep getting the missing_method error on the Add = function.  I have tried a lot of other things, which did not = work.  So, this is where I am now.  If I remove the line with = items.Add or contactFolder.Add -- i get no errors.  Any help would = be appreciated.  Also, I have found the Office Object Models on = MSDN -- this is a huge help, but if there are good examples of Outlook = automation, that would be great.  (well, great if they are in Ruby, = good if they are in VB, which is likely. :)

------=_NextPart_000_0008_01C2C4F1.0CD25AB0--