views:

715

answers:

2

I have an Exchange mailbox linked as a table in an MS Access app. This is primarily used for reading, but I would also like to be able to "move" messages to another folder.

Unfortunately this is not as simple as writing in a second linked mailbox, because apparently I can not edit some fields. Some critical fields like the To: field are unavailable, as I get the following error

"Field 'To' is based on an expression and cannot be edited".

Using CreateObject("Outlook.Application") instead is not an option here, because as far as I know, this gives a security dialog when called from Access.

Any solutions?*

+1  A: 

Is this two problems? Mail can be moved using the Move method. Here is a snippet:

 Set oApp = CreateObject("Outlook.Application")

Set oNS = oApp.GetNamespace("MAPI")

Set oMailItems = oNS.GetDefaultFolder(olFolderInbox)
Set itm = oMailItems.Items(6)
itm.Move oNS.GetDefaultFolder(olFolderDeletedItems)

However, Recipients (To) is read only, even, I believe, with Outlook Redemtion.

Remou
A: 

I don't think Access is the right tool for the job. You will not get around using an Outlook.Application object or a MAPI wrapper like CDO. CDO will be the more elegant and performant way, but it must explicitly be installed on the client via Office Setup.

If you want to avoid the script security dialog (and some of the CDO incapabilities in general), you should give Outlook Redemption a try.

Redemption is a drop-in replacement for CDO and you will be instantly familiar to it when you did any CDO/Outlook VBA coding before.

Tomalak