Form changer

B

Bryan Dickerson

Can anyone point me to a program or script (whichever) that will change
custom forms from one form to another? Another friend pointed me to a copy
of a program from MS that would do it, but the program seems to only work
for the Outlook 2000 client (how ancient!). I have OL 2002 (XP) and most of
the rest of the company has OL 2003.

Thanx!
 
B

Bryan Dickerson

Sounds like I might need to write my own pgm to do this conversion.

What's involved? Just opening the item, changing the messageclass and then
saving it?
If an item is defined as needing a custom form to open it with, how do you
open it without the custom form to change the message class?
 
S

Sue Mosher [MVP-Outlook]

That's all there is to it, except you're not "opening" -- i.e. displaying
the item. In any case, Outlook will use the default form for that type of
item if the designated custom form isn't available.

I'm not sure why you feel the need to write your own, but it's a pretty
trivial operation unless you have thousands of items to change (in which
case, you have to batch them to avoid memory leak issues).

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
B

Bryan Dickerson

I have 5 folders, each of which has between 500 and 4000 items apiece.

I tried copying down the ChangeForms.exe, opening it up with WinZip and
installing the .MSI file that is embedded, but I don't know what disk
directory to point it to and I don't understand what it means by "Install
Forms from" either Microsoft Exchange or Microsoft Outlook.

On the other hand, I have written programs before that step down thru a
folder hierarchy and process items in a loop. It might take a few minutes
to write, but I don't think it would be a major task. Plus I would learn
from it and have it for future uses. So the simple outline/design of the
program would be to find the folder, loop thru each item and set the
MessageClass of the item to the name of the new custom form. Is there a
"save" for each item?
 
S

Sue Mosher [MVP-Outlook]

Yes, there's a Save method. Note that there's at least one script among the
tools I've listed.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
B

Bryan Dickerson

I created a test folder of task items and am testing a VB6 program on it,
but everytime I run the test, despite what I put as the new MessageClass,
the MessageClass after the .Save method is always, IPM.Task, instead of what
I want it to be. I've included the main loop of my code:

'--- oFldr is a MAPIFolder pointing to my tasks folder
For i = 1 To oFldr.Items.Count
oFldr.Items.Item(i).MessageClass = "IPM.Task.NewFormName"
oFldr.Items.Item(i).Save
MsgBox "MessageClass is " & oFldr.Items.Item(i).MessageClass
Next

What am I doing wrong?
 
B

Bryan Dickerson

I think I found the solution. The modified code is as follows:

For i = 1 To oFldr.Items.Count
Set oTask = oFldr.Items.Item(i)
oTask.MessageClass = "IPM.Task.NewFormName"
oTask.Save
Next
Why this works and the other didn't, I don't know, but I'm glad. Now I have
one more question: I have code in the Item_Write event handler that
generates an email msg. When I ran my tests, an email was generated and
displayed. Is there a way besides commenting out the .Display or .Send that
I could tell the task not to execute the Item_Write routine??

Thanx!
 
S

Sue Mosher [MVP-Outlook]

Easier method is to use a For Each loop:

For Each oTask in oFldr.Items
oTask.MessageClass = "IPM.Task.NewFormName"
oTask.Save
Next

If the form has code in Item_Write, you can't avoid having it run if you
save the item as above. One workaround is to change the form. Another is to
perform the message class update with CDO 1.21, which may not be installed
on your machine, instead of Outlook objects. For a one-time operation like
this, I think I'd just publish the form with the Item_Write code removed
then restore it after resetting the message class with the code above.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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