Dolphin App + MS Outlook

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Dolphin App + MS Outlook

Germán S. Arduino
Hello:

I'm evaluating to develop an app that must be integrated with MS Outlook
(The app must be capable of sent mails, read mails, add and read contacts,
calendar and other things of Outlook).

What could be the easy way? Using some ocx?

I'm totally newbie in this question, any help will be useful for me.

Thanks and Best Regards from Argentina.


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Germán S. Arduino
I've read a bit and now I'm dealing with AXTypeLibraryanalyzer and
MSOUTL9.OLB.

I think that is the way (according to Automating MS Outlook 98 from MSDN).

Any opinions or suggestions are welcome, also examples ;-)

Regards.



"Germán S. Arduino" <[hidden email]> escribió en el mensaje
news:ao7hkv$k8tq0$[hidden email]...

> Hello:
>
> I'm evaluating to develop an app that must be integrated with MS Outlook
> (The app must be capable of sent mails, read mails, add and read contacts,
> calendar and other things of Outlook).
>
> What could be the easy way? Using some ocx?
>
> I'm totally newbie in this question, any help will be useful for me.
>
> Thanks and Best Regards from Argentina.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Germán S. Arduino
Well, The right steps are (I think) the following:

1. In ActiveX Component Wizard add Microsoft Outlook 9.0 Object Library
(MSOUTL9.OLB).
2. Press Next button (Not sure if is needed too check Define Method
Protocols).
3. Press Generate button. (All well, I'm getting only some warnings of this
type: Warning:
Selector #class for UserProperty.Class is reserved, using #class_ instead)
4. In a workspace try:  x := Outlook_Application new and so.

I will continue trying.

Regards.

---
Germán Arduino
http://www.rva.com.ar


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Germán S. Arduino
> 4. In a workspace try:  x := Outlook_Application new and so.
>

Well, the problem now is understando how to make the things to work.

I've only VB examples, and don't know how to use the Dolphin generated
classes.

Any help will be appreciated.

Regards.


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Don Rylander-3
Germán, if your application is going to focus on creating and reading
Outlook items, you should probably play around with methods for creating and
accessing them.  That means that you'll be doing work with the
Outlook_Application's session (Outlook_NameSpace?) and its folders.  You
might want to start by adding some shortcut methods to your generated
classes.  For example, getting the inbox from an Outlook_Application
instance would normally require something like:

     |olSession mailboxName inbox|
     olSession := outlook session.
     mailboxName := 'Mailbox - ', olSession currentUser name.
     inbox := (olSession folders item: mailboxName) folders item: 'Inbox'

Adding a method that makes getting the inbox simpler, to either the session
or Outlook_Application, is a simple improvement you can make.  Eventually
when you've done enough workspace experimentation, you'll probably want to
create a class that wraps an instance of Outlook_Application and provides
behavior closer to what you want for your own application.

One thing I ran into was that the methods you get in the generated classes
are created with all the optional parameters.  A simple improvement is to
add some helper methods to the generated classes that make it simpler to do
routine things.  Then the VB examples, which generally leave off optional
parameters, will be more relevant.  For example, Outlook items have a
#display: method that takes a boolean argument indicating whether you want
it to be modal.  I added #display (self display: false) and #displayModal
(self display: true) methods to Outlook items to have method names that
simplify coding and are clearer about what they do.

Hope this helps,

Don


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Germán S. Arduino
Thanks You very much Don.

Not sure of well understand all, but I will try asap.

Regards.


"Don Rylander" <[hidden email]> escribió en el
mensaje news:aohhnk$livff$[hidden email]...
> Germán, if your application is going to focus on creating and reading
> Outlook items, you should probably play around with methods for creating
and

> accessing them.  That means that you'll be doing work with the
> Outlook_Application's session (Outlook_NameSpace?) and its folders.  You
> might want to start by adding some shortcut methods to your generated
> classes.  For example, getting the inbox from an Outlook_Application
> instance would normally require something like:
>
>      |olSession mailboxName inbox|
>      olSession := outlook session.
>      mailboxName := 'Mailbox - ', olSession currentUser name.
>      inbox := (olSession folders item: mailboxName) folders item: 'Inbox'
>
> Adding a method that makes getting the inbox simpler, to either the
session
> or Outlook_Application, is a simple improvement you can make.  Eventually
> when you've done enough workspace experimentation, you'll probably want to
> create a class that wraps an instance of Outlook_Application and provides
> behavior closer to what you want for your own application.
>
> One thing I ran into was that the methods you get in the generated classes
> are created with all the optional parameters.  A simple improvement is to
> add some helper methods to the generated classes that make it simpler to
do

> routine things.  Then the VB examples, which generally leave off optional
> parameters, will be more relevant.  For example, Outlook items have a
> #display: method that takes a boolean argument indicating whether you want
> it to be modal.  I added #display (self display: false) and #displayModal
> (self display: true) methods to Outlook items to have method names that
> simplify coding and are clearer about what they do.
>
> Hope this helps,
>
> Don
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Germán S. Arduino
In reply to this post by Don Rylander-3
Well, I've made some tests in the workspace, somes go well, anothers not.

I think that the main problem is that I can't to adapt the VB examples to
Dolphin and to relate
how to use the classes generated by the ActiveX Component Wizard.

Does exist some bibliography or paper were read some details about this
question?

Thanks Again.


"Don Rylander" <[hidden email]> escribió en el
mensaje news:aohhnk$livff$[hidden email]...
> Germán, if your application is going to focus on creating and reading
> Outlook items, you should probably play around with methods for creating
and

> accessing them.  That means that you'll be doing work with the
> Outlook_Application's session (Outlook_NameSpace?) and its folders.  You
> might want to start by adding some shortcut methods to your generated
> classes.  For example, getting the inbox from an Outlook_Application
> instance would normally require something like:
>
>      |olSession mailboxName inbox|
>      olSession := outlook session.
>      mailboxName := 'Mailbox - ', olSession currentUser name.
>      inbox := (olSession folders item: mailboxName) folders item: 'Inbox'
>
> Adding a method that makes getting the inbox simpler, to either the
session
> or Outlook_Application, is a simple improvement you can make.  Eventually
> when you've done enough workspace experimentation, you'll probably want to
> create a class that wraps an instance of Outlook_Application and provides
> behavior closer to what you want for your own application.
>
> One thing I ran into was that the methods you get in the generated classes
> are created with all the optional parameters.  A simple improvement is to
> add some helper methods to the generated classes that make it simpler to
do

> routine things.  Then the VB examples, which generally leave off optional
> parameters, will be more relevant.  For example, Outlook items have a
> #display: method that takes a boolean argument indicating whether you want
> it to be modal.  I added #display (self display: false) and #displayModal
> (self display: true) methods to Outlook items to have method names that
> simplify coding and are clearer about what they do.
>
> Hope this helps,
>
> Don
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Don Rylander-3
Could you post an example of the VB code samples you're having trouble with?

Don


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Blair McGlashan
In reply to this post by Don Rylander-3
"Don Rylander" <[hidden email]> wrote in
message news:aohhnk$livff$[hidden email]...
> ...
> One thing I ran into was that the methods you get in the generated classes
> are created with all the optional parameters. ...

As of Dolphin 5, the analyzer will generate a version of the method that
takes all arguments, and another version that defaults all optional
arguments. If you require anything in between, then it is necessary to add
it manually, as Don goes on to suggest.

It should be a relatively mechanical process to relate any VB Active-X
Automation examples to Dolphin if using generated interfaces, and once one
takes into account the fundamental differences between the languages, which
basically boils down to (in this case) lots of syntax and implicit
operations, vs very little syntax and explicit message sending for
everything. I'll leave you to decide which is which :-).

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Germán S. Arduino
In reply to this post by Don Rylander-3
Yes, sure!

First, I'm basing my tests in this article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnout98/htm
l/msdn_movs105.asp

I must, at least, be able to:

1. Add, delete and update contacts information in Outlook (reading a dbf
from another system):
================================================================

In the above article says: "Allows for direct creation of new items such as
e-mail messages and contact entries by using the CreateItem method"
(refering Outlook Application object).

I wasn't able to make works CreateItem.

The example in the article (for a task, not a contact) is:

  Sub CreateTaskItem()
   Dim ol As New Outlook.Application
   Dim ns As Outlook.NameSpace
   Dim itmTask As Outlook.TaskItem

    Set ns = ol.GetNamespace("MAPI")

    'Create a new Task item.
    Set itmTask = ol.CreateItem(olTaskItem)

    'Set some properties of the Task item.
    With itmTask
        .Subject = "Write article"
        .DueDate = "8/22/97"
        .Importance = olImportanceHigh
        .Save
    End With
End Sub

and

2. I must be able to send mails from my app:
==============================

The example in the articles is:

  Sub NewMailMessage()
    Dim ol As New Outlook.Application
    Dim ns As Outlook.NameSpace
    Dim newMail As Outlook.MailItem

    'Return a reference to the MAPI layer.
    Set ns = ol.GetNamespace("MAPI")

    'Create a new mail message item.
    Set newMail = ol.CreateItem(olMailItem)
    With newMail
        'Add the subject of the mail message.
        .Subject = "Training Information for October 1997"
        'Create some body text.
        .Body = "Here is the training information you requested:" & vbCrLf

        'Add a recipient and test to make sure that the
        'address is valid using the Resolve method.
        With .Recipients.Add("[hidden email]")
            .Type = olTo
            If Not .Resolve Then
                MsgBox "Unable to resolve address.", vbInformation
                Exit Sub
            End If
        End With

        'Attach a file as a link with an icon.
        With .Attachments.Add _
            ("\\Training\training.xls", olByReference)
            .DisplayName = "Training info"
        End With

        'Send the mail message.
        .Send
    End With

    'Release memory.
    Set ol = Nothing
    Set ns = Nothing
    Set newMail = Nothing
End Sub


I can get an Outlook_Application ( x := Outlook_Application new) but I can't
figure how to accomplish thinks like:

   Dim ns As Outlook.NameSpace
   Dim itmTask As Outlook.TaskItem

    Set ns = ol.GetNamespace("MAPI")

    'Create a new Task item.
    Set itmTask = ol.CreateItem(olTaskItem)

In Dolphin, Outlook_NameSpace don't accept the new method, then I've made
the following:

z := x getNamespace: 'MAPI'.

And tested with somethings like:

y := z addressLists.
y := z currentUser.
y := z folders.
y := z logon.
y := z mapiobject.
y := z pickfolder.

and works ok, but I can't create an instance of contact item by example, to
save an new contact. Same with mails.

Surely is my lack of knowledgment of some things, I hope be clear with my
examples.

Thanks Again for your time.

Germán.


"Don Rylander" <[hidden email]> escribió en el
mensaje news:aojut4$nb7um$[hidden email]...
> Could you post an example of the VB code samples you're having trouble
with?
>
> Don
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Don Rylander-3
OK, try these:
"Germán S. Arduino" <[hidden email]> wrote in message
news:aok0ch$nfrsm$[hidden email]...
[...]
> 1. Add, delete and update contacts information in Outlook (reading a dbf
> from another system):
ol := Outlook_Application new.
contact := (ol createItem: 2 "olContactItem") asImplType.

Using #asImplType should convert it to an OutlookContact.
Note that olTaskItem = 3.  If you don't want to use literal
numbers in your workspace, you need to have the
OutlookConstants pool dictionary available in your workspace.
To do that, right click in the workspace, click 'Pools...' and select
OutlookConstants.

Using the contact you just created:

contact
     fullName: 'Germán S. Arduino';
     mailingAddressStreet: '123 Any Street';
     mailingAddressCity: 'Your City';
     save.

It should now be in your contacts folder.  You can bring it up in its
default form:
     contact display

You can delete it:
     contact delete

[...]
> 2. I must be able to send mails from my app:
msg := (ol createItem: 0 "olMailItem") asImplType.
recipient := msg recipients add: '[hidden email]'.
recipient resolve ifFalse: [MessageBox notify: 'Unable to resolve address'].

If you look in your Drafts folder, you should see the message you've
created.  Using the msg you just created, you should be able to send it or
delete it.  Note that there can be some annoyances with e-mail addresses,
but those are pretty well documented on-line in Microsoft's MSDN library.

[...]
> Thanks Again for your time.
>
> Germán.
Always glad to help if I can.  Hope this is enough to get you started
properly.

Don


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Germán S. Arduino
Hello Again Don!

> > 1. Add, delete and update contacts information in Outlook (reading a dbf
> > from another system):
> ol := Outlook_Application new.
> contact := (ol createItem: 2 "olContactItem") asImplType.
>
> Using #asImplType should convert it to an OutlookContact.
> Note that olTaskItem = 3.  If you don't want to use literal
> numbers in your workspace, you need to have the
> OutlookConstants pool dictionary available in your workspace.
> To do that, right click in the workspace, click 'Pools...' and select
> OutlookConstants.
> [...]

Works perfectly! I'm wondering where have you found this procedure to make
the things!.

I've tried with some like:
    x := Outlook_Application new.
    (1 to: 7) collect:[:index | (x createItem: index) MessageClass] (inspect
it)

    Then, when I've knew the possible parameters, I've made:

    z := x getNamespace: 'MAPI'.
    y := x createItem: 2.
    y fullName: 'Germán S. Arduino'.
    y save.

But the procedure that You suggest is more clean!  I don't used to know
asImplType nor olContactItem keyword.


> [...]
> > 2. I must be able to send mails from my app:
> msg := (ol createItem: 0 "olMailItem") asImplType.
> recipient := msg recipients add: '[hidden email]'.
> recipient resolve ifFalse: [MessageBox notify: 'Unable to resolve
address'].
> [...]

Ok, Thanks, I will try starting with your example.


> Always glad to help if I can.

Thanks!

> Hope this is enough to get you started properly.
>

Surely!, really Thanks by your help!

Regards.

Germán.


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin App + MS Outlook

Germán S. Arduino
In reply to this post by Blair McGlashan
Thanks by your response Blair.

I'm yet newbie with Dolphin and can't relate easily the thinks with VB (Not
an expert neither).

Thanks Again and Regards.


"Blair McGlashan" <[hidden email]> escribió en el mensaje
news:aok07k$mu5ci$[hidden email]...
> "Don Rylander" <[hidden email]> wrote in
> message news:aohhnk$livff$[hidden email]...
> > ...
> > One thing I ran into was that the methods you get in the generated
classes

> > are created with all the optional parameters. ...
>
> As of Dolphin 5, the analyzer will generate a version of the method that
> takes all arguments, and another version that defaults all optional
> arguments. If you require anything in between, then it is necessary to add
> it manually, as Don goes on to suggest.
>
> It should be a relatively mechanical process to relate any VB Active-X
> Automation examples to Dolphin if using generated interfaces, and once one
> takes into account the fundamental differences between the languages,
which
> basically boils down to (in this case) lots of syntax and implicit
> operations, vs very little syntax and explicit message sending for
> everything. I'll leave you to decide which is which :-).
>
> Regards
>
> Blair
>
>