Item.Copy leaves Item in Outbox

P

Paul

I'm writing an application that archives messages to an external
archive and then compacts a users mailbox by removing attachments and
some or all of the body from the email message. When a user clicks on
the compacted message a custom form retrieves the message from the
archive, creates a new Item using CreateItemFromTemplate, adds the
entryID of the folder the compacted message is in and the entryID of
the compacted message as UserProperties and changes the MessageClass so
the retrieved item will be viewed with another custom form that has a
button to restore the full message to the folder. To get the new form
to show I copy the restored, altered item to another one and display
it, otherwise it just displays the default form. Here is the code for
that operation

Set newItem = Item.Application.CreateItemFromTemplate(tempName)
newItem.MessageClass = "IPM.Note.RMMView"
Set rmmProp = newItem.UserProperties.Add("RMMID", 1, False)
rmmProp.Value = Item.EntryID
Set rmmFProp = newItem.UserProperties.Add("RMMFID", 1, False)
rmmFProp.Value = Item.Parent.EntryID
Set viewItem = newItem.Copy
viewItem.Display
fso.DeleteFile tempName
Set rmmProp = Nothing
Set rmmFProp = Nothing
Set newItem = Nothing
Set viewItem = Nothing

When the Item is copied it creates an Item in the Outbox that I cannot
delete programatically. In the Item_Close event for the other custom
form I tried Item.Delete. It completes successfully but the Item is
not deleted. I also tried Item.Move, which moves the Item and then
deleting the moved Item but it will not delete. What should I do to
delete it?

Thanks,
Paul
 

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