Four Js Development Tools Forum

Discussions by product => GDC => Topic started by: . on April 10, 2008, 01:30:33 pm



Title: WinCOM
Post by: . on April 10, 2008, 01:30:33 pm
where can I find any documentation about methods and properties for excel and outlook

thanks a lot

Ralph


Title: Re: WinCOM
Post by: Lionel F. on April 10, 2008, 06:20:25 pm
Hello Ralph,

Concerning Excel, you can find an example in the Genero Desktop Client documentation :
https://4js.com/online_documentation/fjs-gdc-2.10.01-manual-html/User/WinCOM.html (https://4js.com/online_documentation/fjs-gdc-2.10.01-manual-html/User/WinCOM.html)

As you probably know, The Wincom API is based on VBA, therefore our syntax is really close to this language.

My method (at least with Excel and Word) : recording a macro of what I'm expecting to achieve, and adapting the VBA code to the WinCom functions (mainly with CallMethod and SetProperty).


Now, how does it work with Outlook :

1) Create the Microsoft Outlook object

How to create the Outlook object in VBA  :

Code
  1. Set spObj = CreateObject("Outlook.Application")


How to create the Outlook object in BDL :

Code
  1. ##In this whole example, xlapp, xlwb, xlwb2, xlwb3, xlwb4 are the handles.
  2. ##They are some integer values which can be used for a later call to the API.
  3.  
  4. CALL ui.interface.frontcall("WinCOM", "CreateInstance", ["Outlook.Application"], [xlapp])


2) Create object of Outlook (contact, appointment and so on...). Find below the URL which shows the various Microsoft Outlook's objects:
http://msdn2.microsoft.com/en-us/library/aa271596(office.11).aspx (http://msdn2.microsoft.com/en-us/library/aa271596(office.11).aspx)

Example with a ContactItem object. That would allow you, for example, to automatically add a new contact from a BDL program to Microsoft Outlook :

In VBA :

Code
  1. Set MyItem = spObj.CreateItem(olContactItem)


In BDL:

Code
  1. CALL ui.interface.frontcall("WinCOM", "CallMethod", [xlapp, "CreateItem(olContactItem)"], [xlwb])



3) Display the contact form of Outlook :

In VBA :

Code
  1. MyItem.Display


In  BDL :

Code
  1. CALL ui.interface.frontCall("WinCOM", "CallMethod", [xlwb, "Display"], [xlwb2])


4) Now, you're probably expecting to file some fields of the contact form  (First Name, Name, Address and so on...). In order to achieve this, you have to know the various properties of the object (i.e. : in this case, the ContactItem object). This is also available from the MSDN website from Microsoft :     
 
msdn2.microsoft.com/en-us/library/aa210907(office.11).aspx (http://msdn2.microsoft.com/en-us/library/aa210907(office.11).aspx) (see the bottom of the page)

Now, you just have to set those properties with the function "SetProperty"  of the WinCom API, e.g. :

Code
  1. # First Name
  2. CALL ui.interface.frontCall("WinCOM", "SetProperty", [xlwb, "FirstName", "Lionel"], [xlwb3])
  3. # Email address  
  4. CALL ui.interface.frontCall("WinCOM", "SetProperty", [xlwb, "Email1Address", "lif@4js.com"], [xlwb3])
  5. # Business Address
  6. CALL ui.interface.frontCall("WinCOM", "SetProperty", [xlwb, "BusinessAddress", "1 rue de Berne"], [xlwb3])


5) Save your contact form with the "Save"  method of the ContactObject (find the methods available at the same URL than the properties):

Code
  1. CALL ui.interface.frontCall("WinCOM", "CallMethod", [xlwb, "Save"], [xlwb4])


Of course, this method can be applied to the other objects of the Outlook models (appointment, journal ....). You just have to follow the corresponding MSDN properties and methods.

I hope it helps. Let me know if you need further information.
Best regards,

Lionel



Title: Re: WinCOM
Post by: . on April 16, 2008, 12:58:46 pm
excel works fine

next I'll give a try to outlook...

thanks a lot

Ralph


Title: Re: WinCOM
Post by: . on July 30, 2008, 04:24:14 pm
hello again,

now everything works fine with outlook, too.
But there is some problem using property attachments

We use
 CALL ui.Interface.frontCall("WinCOM", "SetProperty", [xlwb, "Attachments.add",p_str], [result])
to add the attachment.


we tried with
LET p_str = "C:\\documents\\test.doc"
or
LET p_str = "C:/documents/test.doc"

we only get the information
"Fehler beim Ausführen der Operation."





Title: Re: WinCOM
Post by: Lionel F. on August 01, 2008, 02:22:33 pm
Hello Ralph,

With the version I tested (Outlook 2003-SP2) , you have to proceed like this :

Code
  1. CALL ui.interface.frontCall("WinCOM", "CallMethod", [xlwb, "Attachments"], [xlwb2])

and then :

Code
  1. CALL ui.interface.frontCall("WinCOM", "CallMethod", [xlwb2, "Add", "c:\\documents\\test.doc"], [xlwb3])


I hope it helps. Let me know if you need further information.

Regards,
Lionel


Title: Re: WinCOM
Post by: . on August 01, 2008, 03:02:48 pm
great
now it works

thanks a lot

Ralph