Linking to Forms via HTML -- If not installed, it opens blank e-mail

D

David Hampson

Here's some background:

I've created some VBScript on a web page that takes a path to a form in the
Public Folders, parses it out, traverses the folders to the one containing a
form, and then opens the form.

For those who have tried to do this and failed, I don't have the code in
front of me (I'm at home, can't get to newsgroups directly at work) but I
pass the path as a string with ^s as separators (Because hopefully nobody
names a Public Folder with a ^ in it) like this:

"Public Folders^Folder1^Folder2^Folder3^FormName"

I then split that into an array, and use a For Next loop to the UBound -1 to
traverse the folders.

I then open the Form using mailitem = folder.items.add("IPM.Note." &
Array(Ubound(Array)))

This works great, IF the user has this form installed in their Outlook. If
not, they get a standard blank e-mail message.

What I need is code to install the form locally before it tries to open it.
I did some Google searches at work today, and found a couple of snippets,
but couldn't really translate that into what I needed.

Any ideas?

Thanks,

Dave Hampson

P.S. If anyone wants the VBScript that parses the Path to open a form buried
inside Public Folders, let me know, I can mail it home and post it.
 
D

David Hampson

Sue,

I saw that earlier, and I've got that in my code, but didn't have a chance
to test it before I left work. I wasn't sure it would work because I was
opening a form from a Public Folder and not from an OFT file. My code has
the mailitem.formdescription.publishform(2) line right after the
mailitem.items.add(IPM.Note.Formname) line. I have a feeling that won't
work, but I'll try it tomorrow morning.

Thanks,

Dave H.
Did you look at the FormDescription.PublishForm method? See
http://www.outlookcode.com/d/distributeforms.htm
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
T

TowerDave

Sue,

I tried this, but since the form isn't installed yet locally, it just
opens a blank e-mail. I went into the Personal Forms Library, and the
form was listed. When I double-clicked, it installed it then. I need my
code to force that installation so it will then open the correct form,
and not a blank e-mail.

Any more ideas?

Here is my code. (I am a new Google Groups fan. I can get to this group
through there)

Sub OpenOutlookDoc(FolderPath)

aFolders = Split(FolderPath, "^")

Set objOutlook = CreateObject("Outlook.Application")
Set objNS = objOutlook.GetNamespace("MAPI")

Set fldr = objNS.Folders(aFolders(0))

For i = 1 To UBound(aFolders) - 1
Set fldr = fldr.Folders(aFolders(i))
'msgbox(aFolders(i))
'check for errors
If Err <> 0 Then Exit Sub
Next
'msgbox(FormName)
set mailitem = fldr.items.add("IPM.Note." &
aFolders(UBound(aFolders)))
mailitem.formdescription.displayname = aFolders(UBound(aFolders))
mailitem.formDescription.publishform(2)
mailitem.display(0)

End Sub
-->

And the folder path I am passing is formatted as I stated above.

Thanks,

Dave Hampson
 
S

Sue Mosher [MVP-Outlook]

If you're using a statement like this to create the item:

set mailitem = fldr.items.add("IPM.Note." & aFolders(UBound(aFolders)))

it should work ***if*** the form is published in the folder represented by the fldr variable.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
T

TowerDave

Sue,

The form is published to the Public Folders, and if I go to Tools,
Choose Form, and double-click on the form from the Public Folders which
causes it to be installed to my machine and THEN click on the link, it
works fine. If a user clicks the link before doing that, it just opens
a standard blank e-mail message. That is my issue. Obviously we would
rather not have to install all of these forms locally, but would rather
have the code on the web site take care of that.

I really appreciate any assistance you can provide.

Thanks,

Dave Hampson
 
S

Sue Mosher [MVP-Outlook]

Oh, yuck.

Here's a possible alternative -- store the form as an .oft file free doc in the folder, then use your code to save the free doc Attachment as a file, invoke the .oft with CreateItemWithTemplate and use the resulting MailItem to publish the form.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


TowerDave said:
Sue,

The form is published to the Public Folders, and if I go to Tools,
Choose Form, and double-click on the form from the Public Folders which
causes it to be installed to my machine and THEN click on the link, it
works fine. If a user clicks the link before doing that, it just opens
a standard blank e-mail message. That is my issue. Obviously we would
rather not have to install all of these forms locally, but would rather
have the code on the web site take care of that.

I really appreciate any assistance you can provide.

Thanks,

Dave Hampson
If you're using a statement like this to create the item:

set mailitem = fldr.items.add("IPM.Note." & aFolders(UBound(aFolders)))

it should work ***if*** the form is published in the folder represented by the fldr variable.

TowerDave said:
Sue,

I tried this, but since the form isn't installed yet locally, it just
opens a blank e-mail. I went into the Personal Forms Library, and the
form was listed. When I double-clicked, it installed it then. I need my
code to force that installation so it will then open the correct form,
and not a blank e-mail.

Any more ideas?

Here is my code. (I am a new Google Groups fan. I can get to this group
through there)

Sub OpenOutlookDoc(FolderPath)

aFolders = Split(FolderPath, "^")

Set objOutlook = CreateObject("Outlook.Application")
Set objNS = objOutlook.GetNamespace("MAPI")

Set fldr = objNS.Folders(aFolders(0))

For i = 1 To UBound(aFolders) - 1
Set fldr = fldr.Folders(aFolders(i))
'msgbox(aFolders(i))
'check for errors
If Err <> 0 Then Exit Sub
Next
'msgbox(FormName)
set mailitem = fldr.items.add("IPM.Note." &
aFolders(UBound(aFolders)))
mailitem.formdescription.displayname = aFolders(UBound(aFolders))
mailitem.formDescription.publishform(2)
mailitem.display(0)

End Sub
-->

And the folder path I am passing is formatted as I stated above.

Thanks,

Dave Hampson


Sue Mosher [MVP-Outlook] wrote:
Did you look at the FormDescription.PublishForm method? See http://www.outlookcode.com/d/distributeforms.htm

Here's some background:

I've created some VBScript on a web page that takes a path to a form in the
Public Folders, parses it out, traverses the folders to the one containing a
form, and then opens the form.

For those who have tried to do this and failed, I don't have the code in
front of me (I'm at home, can't get to newsgroups directly at work) but I
pass the path as a string with ^s as separators (Because hopefully nobody
names a Public Folder with a ^ in it) like this:

"Public Folders^Folder1^Folder2^Folder3^FormName"

I then split that into an array, and use a For Next loop to the UBound -1 to
traverse the folders.

I then open the Form using mailitem = folder.items.add("IPM.Note." &
Array(Ubound(Array)))

This works great, IF the user has this form installed in their Outlook. If
not, they get a standard blank e-mail message.

What I need is code to install the form locally before it tries to open it.
I did some Google searches at work today, and found a couple of snippets,
but couldn't really translate that into what I needed.

Any ideas?

Thanks,

Dave Hampson

P.S. If anyone wants the VBScript that parses the Path to open a form buried
inside Public Folders, let me know, I can mail it home and post it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top