[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Unable to manipulate Outlook 2003 folders - MAPIFolder.get_Folders produces messaging interface err.

T. St.

10/1/2007 10:45:00 AM

Im am developing an Outlook 2003 Add-In application using VSTO and MS
Office 2003 Primary Interop Assemblies. In the Add-In startup method,
the application creates custom email and task folders. Although I had
many successfull installations of the Add-In, on some user machines the
following error occurs:

System.Runtime.InteropServices.COMException (0xDAC40103): The messaging
interface has returned an unknown error. If the problem persists,
restart Outlook.
at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Folders()
at MyApp.App.CreateFolders()
at MyApp.ThisAddIn.ThisAddIn_Startup(Object sender, EventArgs e)

An important point is that the above error occurs only if Exchange
caching mode is activated in Outlook. Unfortunately further Add-In
functinality requires this mode and I cannot deactivate it to solve the
problem. The user machines, where the problem occurs, have large OST
files - about 5 GB as they had a lot of email on the Exchange prior to
activating the cache mode. The CreateFolders method is as follows:

Public Sub CreateFolders()
Dim mailbox As MAPIFolder
mailbox =
ThisAddIn.OlApplication.Session.GetDefaultFolder(OlDefaultFolders.olFold
erInbox).Parent

Dim ci As Globalization.CultureInfo = Util.getCultureInfo
Dim tasksFolderName As String = "MyTasks"
Dim mailFolderName As String = "MyMail"
Dim trackingFolderName As String = "MyTracking"

Try
tasksFolder = mailbox.Folders.Item(tasksFolderName)
Catch cex As Runtime.InteropServices.COMException
tasksFolder = mailbox.Folders.Add(tasksFolderName,
OlDefaultFolders.olFolderTasks)
End Try

Try
mailFolder = mailbox.Folders.Item(mailFolderName)
Catch cex As Runtime.InteropServices.COMException
mailFolder = mailbox.Folders.Add(mailFolderName,
OlDefaultFolders.olFolderInbox)
End Try

Try
trackingFolder = mailFolder.Folders.Item(trackingFolderName)
Catch cex As Runtime.InteropServices.COMException
trackingFolder = mailFolder.Folders.Add(trackingFolderName,
OlDefaultFolders.olFolderInbox)
End Try
End Sub

If the custom folders are missing, the "Try" results in a COMException
"The operation failed. An object could not be found." and the
appropriate folders are created on the first start.

Help will be highly appreciated as the issue seems rather difficult to
tackle with.

*** Sent via Developersdex http://www.develop... ***