Outlook View Control Folder property

  • Thread starter Thread starter Nency
  • Start date Start date
N

Nency

Hi all,

I am trying to make an Outlook 2003 add-in using Visual Studio 2008 on
Windows XP SP3.

My add-in is using custom Folder Home Page which displays my custom form,
which wraps Outlook View Control.

When I try to set Folder property of the OVC, I get COM Exception with
'Unknown Error' description every time. I am using value of the
CurrentFolder.FolderPath property of the active explorer:

Outlook.Explorer currentExplorer = app.ActiveExplorer();
if (currentExplorer != null)
{
ovcWrapper.Folder = currentExplorer.CurrentFolder.FolderPath;
}
Folder is located in non-default PST file.

I must underline that everything worked just fine before I went to holiday :).

Thanks,

Nenad
 
After a while, I finally find out what was the problem: name of the external
storage cannot be 'Documents' :(.

During startup of the addin, it loads the non-default PST file, and changes
its name (not the name of the pst file, but the name of the root folder) to
"Documents". Well, it was allowed before, but now it is not - Outlook View
Control throws an exception when you try to set a Folder property.

This is lines of code which caused a problem:

session.AddStore("C:\\test.pst"); // loads existing or creates a new one, if
there is none.
storage = session.Folders.GetLast(); // grabs root folder of the new
fileStorage.

if (storage.Name != storageName) // if fileStorage is brand new, it has
default name.
{
storage.Name = "Documents";
session.RemoveStore(storage); // to apply new fileStorage name, it
have to be removed and added again.
session.AddStore(storagePath);
}
 
I have some clarification regarding my solution to the issue. Problem is not
in the specific name of the storage (I mentioned "Documents") but in the fact
that, for some reason, any name of the storage become a problem.

When I change a name of the external storage (see code above) to be some
new, everything works fine for some time, but than suddenly, unknown COM
exception shows up. Than, I change a name of the storage to be something new
(not 'Documents' but 'Test' for example) and everything works fine again for
some time.
 
Back
Top