copy values from one to another form

D

Dasha

Hi!

Can anyone help me with the following:

I've opened saved item (based on custom IPM.POST form), and when the
user clicks a button I need to create a duplicate item and copy the
data from the original form to the new one.

How can I do this using VBScript?

Many thanks for any help in advance.

Dasha
 
S

Sue Mosher [MVP-Outlook]

Why not just create a copy of the whole item?

Set newItem = originalItem.Copy
newItem.Save

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

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

Ken Slovak - [MVP - Outlook]

I'd use the Item.Copy method to create the copy already populated with the
original data. Just have your button click event copy the item.
 
D

Dasha

I'm using Exchange workflow, so when I do Item.Copy I get error "Adhoc
workflows are disallowed for this folder. The new process instance
cannot be created". Do you know what the problem is?
 
S

Sue Mosher [MVP-Outlook]

If you're not allowed to create new items in that folder except through the workflow process, then create a new IPM.Post in another folder with the MAPIFolder.Items.Add method, then copy property values one by one. You should be able to do most if not all by iterating the ItemProperties collection.

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

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

Dasha

It's easier then I thought:
Set olns = Item.Application.GetNameSpace("MAPI")
Set MyFolder1 = olns.Folders("Public Folders")
Set MyFolder2 = MyFolder1.Folders("All Public Folders")
Set MyFolder3 = MyFolder2.Folders("payment")
Set MyItem = MyFolder3.Items.Add

'filling fields
MyItem.UserProperties("fCardType").Value =
Item.UserProperties("fCardType").Value

Thanks to all :)
 
Top