borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (Milage calculator) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Shell Extension and Outlook
Poster Message
SamuelHenderson
Level: Trainee

Registered: 07-12-2007
Posts: 1

icon Shell Extension and Outlook

Greetings,

I need to develop a shell extension that allows a user to copy the full path of a selected file into an Outlook mail message so that the recipient can click a on the filepath in the message and open the file.

This extension will be used internally where I work.  The files are located on a shared drive that all our employees have access to.  The users should be able to right click a file on the shared drive and in the "send to" menu, there should be an additional option of something like "Send path via email" which upon clicking would open Outlook with the file path already in the message body.

We are using Windows XP Pro SP2 and Outlook 2003.  The extension needs to be developed in VB6.

I'm not sure where to begin on this one... any pointers?

____________________________
Regards,
Sam

10-12-2007 at 01:05 PM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 908
icon Re: Shell Extension and Outlook

Hi
Look for CDO vb6 (to create a mail message)
The following code will send a generic mail from your machine (win 2k+)


Private Sub Form_Load()

    Dim oCDO As Object

    On Error Resume Next
    Set oCDO = CreateObject("CDO.Message")
    On Error GoTo EH
    If oCDO Is Nothing Then
        MsgBox "Unable to create CDO.Message object"
        Exit Sub
    End If

    With oCDO
        .To = ""
        .Subject = "CDO Test Email"
        .TextBody = "This is a test of sending email using CDO"
        .Send
    End With

    Exit Sub

EH:
    MsgBox Err.Description, vbOKCancel, Err.Source

End Sub


Write a vb6 application that has a form and paste in this code.

Add a shortcut to your program to the "Send To" by creating a shortcut in c:\documents and settings\username\sendto
where username is your login

In vb6 there is a built-in function called Command$ which is the parameters that windows has sent to your application ( in this case it'll be the filename), so modify the code thus:




Private Sub Form_Load()

    Dim oCDO As Object

    On Error Resume Next
    Set oCDO = CreateObject("CDO.Message")
    On Error GoTo EH
    If oCDO Is Nothing Then
        MsgBox "Unable to create CDO.Message object"
        Exit Sub
    End If

    With oCDO
        .To = ""
        .Subject = "CDO Test Email"
        .TextBody = "Filename" & command$
        .Send
    End With

    Exit Sub

EH:
    MsgBox Err.Description, vbOKCancel, Err.Source

End Sub


If you don't specify the "to" address. Outlook should prompt you and display the mail for editing.

Hope this helps (I'm working from theory, as my vb is broken)
Kieron



[Edited by stickleprojects on 11-12-2007 at 07:11 AM GMT]

____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

11-12-2007 at 07:10 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Shell Extension and Outlook
Next Topic (Milage calculator) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder