Save in Target Folder Sample Forms
|
|
|
This sample Microsoft Outlook journal form
demonstrates the code needed to force an Outlook item to save in a
particular folder. You can use it to save journal items to a public Journal folder. See Creating a Public Journal for Microsoft Outlook
You can also adapt the technique to other types of forms, except
for message forms, simply
by copying the source code from one of the two samples and modifying
the target folder path, as described under Setup.
Setup | Usage
| Notes | Limitations
| Problems | More
Information
|
Setup
|
- Download the Savefold.zip
file (7.3 kb), then unzip it and open JournalMove.oft. Choose Disable Macros when you
see the macro prompt.
- Click the View Code button to display the form's code.
- Under the InitOpts procedure, provide the full path to the
target folder where you want to save items using this form. For
appointment and journal forms, you can also set whether you want
Start date for the item to default to the current date/time.
Otherwise, new items may default to the date the form was
published.
- Follow the procedure below for publishing the form, probably
to the Organization Forms library.
To publish a form with Outlook 97:
- In the open item that you want to publish as a form, choose File |
Publish Form As.
- In the Publish Form As dialog box, enter a Form
name, which will be used to select the form from the folder menu or
forms library.
- Click Publish In and select the location
where you want to publish the form, then click OK.
- Back in the Publish Form As dialog, click Publish.
To publish a form with Outlook 98 or Outlook 2000:
- In the open item that you want to publish as a form, choose Tools
| Forms | Publish Form.
- In the Publish Form As dialog box, use the Look
In list and Browse button to select the location
where you want to publish the form.
- Give the form a Display name, which will be used to
select the form from the folder menu or forms library, and Form name.
- Click the Publish button.
After publishing, the form is installed and ready to use.
Published form locations
Outlook forms can be published to three different types of form
"libraries":
| Personal Forms |
Library of forms stored in your Personal Folders or Exchange Server
mailbox. |
| Organization Forms |
Library of forms stored on the Exchange Server for group use. You need
permission from the Exchange Server administrator to publish to this
library. |
| Folder Forms |
Library of forms associated with a particular folder, either in your
mailbox or Personal Folders or in a public folder on the Exchange Server. |
To remove a published form, choose Tools | Options | Manage Forms, and
use the Forms Manager that pops up. This function is not available in Outlook 98
or Outlook 2000 in Internet Mail Only mode, only in Corporate/Workgroup mode.
For more information on distributing forms, see How
do I distribute Outlook forms to other users?
|
| Back
to top |
|
Usage
|
The user simply runs the form directly using normal form methods
or, if you have used the Outlook 2000 Forms Administration tool to
make this form the default, the user just creates a new item.
The fact that the form saves in a folder other than the default
folder for the type of item is transparent to the user.
|
| Back
to top |
|
Notes
|
The
technique that makes this form save in a specific folder is to
create a copy of the item using the Copy method, then use the Move
method on the copy to put it in the target folder. The original item
is discarded. The fact that the item is a copy is recorded in the
built-in BillingInformation field. If your application needs to use
this field for some other purpose, you must modify the sample forms'
code to replace BillingInformation with either the built-in Mileage
field or a user-defined field.
The forms' code includes a generic GetMAPIFolder() function that takes the folder path as its
argument and returns a MAPIFolder object. Feel free to
copy it to other Outlook projects where you need to return
folders other than the Outlook default |
| Back
to top |
|
Limitations
|
When the
user saves the item, the item closes -- even if the user clicks
Save, rather than Save and Close. This is because the open item is
the original, not the copy that was moved to the target folder, and
must be discarded to avoid confusing the user about which is the
"real" item. Redisplaying the copy automatically is
difficult, if not impossible. At the time the item is copied and
moved to the target folder -- i.e. when Write event fires -- there
is no way to know whether the user has clicked Save or Save and
Close. If your application needs to keep the item open, you might
want to handle this by prompting the user to choose whether to
redisplay the item. To obtain the moved item, you would use the Find
method on the target folder's Items collection |
| Back
to top |
|
Problems
|
No
specific known problems. |
| Back
to top |
|
More Information
|
|
Updated 01 May 2000
|
Home
| What's New | Exchange
Server | Outlook | Utilities
| Bookstore
About Slipstick | Feedback
| Site Map
|
|