Reading Registry Problem

Add-in Express™ Support Service
That's what is more important than anything else

Reading Registry Problem
 
Minhaj Khan




Posts: 15
Joined: 2006-08-17

Hi

For a custom created folder (i.e. Personal Folders\DK), the following properties, WebViewAllowNavigation and WebViewOn has been respectively set to true. Moreever the RegistryKey is also written to the windows registry.

Bear in mind that AdxOlFormManager1.Items[0].FolderNames is not resulting with an appropriate return (using Key.GetValue()) but despite an exception is thrown as given under

Detailed technical information follows:

Assembly Codebase: file:///C:/WINDOWS/assembly/GAC_MSIL/AddinExpress.MSO.2005/2.7.1762.2005__c20c070a1fc9a144/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=2.7.1762.2005, Culture=neutral, PublicKeyToken=c20c070a1fc9a144
Assembly Version: 2.7.1762.2005
Assembly Build Date: 28/10/2004 01:06:50

Exception Source: AddinExpress.OL.2005
Exception Type: System.NullReferenceException
Exception Message: Object reference not set to an instance of an object.
Exception Target Site: get_IsEnableForExplorer

---- Stack Trace ----
AddinExpress.OL.ADXOlFormsCollectionItem.get_IsEnableForExplorer()
AddinExpress.MSO.2005.dll: N 0057 (0x39) IL
AddinExpress.OL.ADXOlFormsManager.get_HasWebViewPane()
AddinExpress.MSO.2005.dll: N 0004 (0x4) IL
AddinExpress.OL.ADXOlFormsManager.RefreshFolderSettings()
AddinExpress.MSO.2005.dll: N 0044 (0x2C) IL
AddinExpress.OL.ADXOlFormsCollectionItem.ProcessChangingProperty()
AddinExpress.MSO.2005.dll: N 0029 (0x1D) IL
AddinExpress.OL.ADXOlFormsCollectionItem.set_FolderNames(value As ADXOlFolderNamesCollection)
AddinExpress.MSO.2005.dll: N 0007 (0x7) IL
OurClient.AddinModule.AddinModule_AddinStartupComplete(sender As Object, e As EventArgs)
AddinModule.cs: line 0177, col 11, IL 0355 (0x163)
AddinExpress.MSO.ADXAddinModule.Extensibility.IDTExtensibility2.OnStartupComplete(custom As Array&)
AddinExpress.MSO.2005.dll: N 0834 (0x342) IL


(Outer Exception)
Assembly Codebase: file:///C:/WINDOWS/assembly/GAC_MSIL/AddinExpress.MSO.2005/2.7.1762.2005__c20c070a1fc9a144/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=2.7.1762.2005, Culture=neutral, PublicKeyToken=c20c070a1fc9a144
Assembly Version: 2.7.1762.2005
Assembly Build Date: 28/10/2004 01:06:50

Exception Source:
Exception Type: AddinExpress.MSO.ADXExternalException
Exception Message: Error occured in the code of the add-in.
Exception Target Site: Object reference not set to an instance of an object.

---- Stack Trace ----


Any help will be appreciated. Thanks.
Posted 16 Oct, 2006 08:15:02 Top
Fedor Shihantsov


Guest


Do you have any code in the StartupComplete event?
Posted 16 Oct, 2006 10:09:28 Top
Minhaj Khan




Posts: 15
Joined: 2006-08-17

Yes, both at startup as well as other parts of program.
During startup, a root level folder is created while at other parts sub-folders are created based on certain criteria. What the observation is that for root folder, i.e. at Startup works fine but fails to do so for the rest of the sub-folders. Does that leads to conclusion that AddinExpress.MSO.2005.dll performs some extra processing steps before or during loading add-in as indicated by stack trace? If yes, would like to know and if not, what will be the alternates?
Posted 17 Oct, 2006 00:30:13 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Minhaj.

ADX only connects to Outlook events after the ADXStartupComplete event fires.
Posted 17 Oct, 2006 10:09:50 Top
Minhaj Khan




Posts: 15
Joined: 2006-08-17

I am afraid I know this but please read back while I try to be more precise. Following ADX Extension Hello World example shipped with the product, I had one root folder named Personal Folders\DK, that is created at AddinStartupComplete event. Registry key as well web view pane is automatically set for this folder.

Later during the course of add-in, numerous sub-folders (unknown at design time) are created. Obviously in this case, AddinStartupComplete event will no longer be helpful to do the same job, i.e. to enable web view pane for run-time generated sub-folders.

I had followed this phrase from (dxxnetol.pdf) Developer guide (p34) saying

"How can you bind your forms to Outlook folders? First of all, you can do it via the Items collection designer of the Outlook Forms Manager, as shown above. If you need to do it by code (on-the-fly), you should handle the ADXBeforeFolderSwitch event of the Outlook Forms Manager and create new items here, delete existing items, enable/disable them, bind to other folders, etc. In general, only in the handler of ADXBeforeFolderSwitch you can change the Items collection of the Outlook Forms Manager."

The resulting code snippet is under as

private void frmManager_ADXBeforeFolderSwitch(object explorerObj,
AddinExpress.OL.ADXOlFormsCollectionItem SrcItem, object SrcFolder,
AddinExpress.OL.ADXOlFormsCollectionItem DstItem, object DstFolder)
{
this.frmCollection.FolderName = ((MAPIFolder)DstFolder).FullFolderPath.Substring(2);
try
{
if (key == null)
key = Registry.CurrentUser.CreateSubKey(RegistryKey);
else
key = Registry.CurrentUser.OpenSubKey(RegistryKey, true);

frmManager.LockUpdates();
key.SetValue("FolderPath", this.frmCollection.FolderName);
frmManager.UnlockUpdates();
}
finally
{
if (key != null) key.Close();
}
}

Output from above code showed that registry value has been updated successfully. During debugging, it was observed that Outlook tried to display/render visual GUI by invoking this method given under

public override System.ComponentModel.IContainer GetContainer()
{
if (components == null)
components = new System.ComponentModel.Container();
return components;
}

After this method, outlook immidiately crashes while trying to load, display and/or render. Hope this clarifies the matter in question. Thanks anyhow for your reply.

Posted 18 Oct, 2006 01:20:03 Top
Fedor Shihantsov


Guest


I don't undestand the cause of the problem. I don't understand also why you use the following code.

frmManager.LockUpdates();
key.SetValue("FolderPath", this.frmCollection.FolderName);
frmManager.UnlockUpdates();

What is the value of the RegistryKey?

Please check your Inbox - I've sent you a private email.
Posted 26 Oct, 2006 13:38:58 Top