PropertyPage Added but no "Apply" Callback

  • Thread starter Jörg-Ulrich Wölfel
  • Start date
J

Jörg-Ulrich Wölfel

I successfully add a PropertyPage to the Options Dialog from within an
Outlook Addin written in C#.

But the "Apply"-Method of my UserControl implementing the
"PropertyPage"-Interface is not called.

I guess that I have to call the "OnStatusChanged" method of the
"PropertyPageSite". But I do not know how to get that PropertyPageSite from
my C# Code.

Thank you
Jörg
 
S

Sunny

Hi,


I successfully add a PropertyPage to the Options Dialog from within an
Outlook Addin written in C#.

But the "Apply"-Method of my UserControl implementing the
"PropertyPage"-Interface is not called.

I guess that I have to call the "OnStatusChanged" method of the
"PropertyPageSite". But I do not know how to get that PropertyPageSite from
my C# Code.

Thank you
J?rg

you have to use reflection to get it, as this is unsafe private field
for the user controls.

Note that this is not supported, and it may break if there are some
changes in the implementation of window forms in some of the next
versions of the framework. It is nice that it works with SP1 :)

Here is my code. Put it in the Load event handler of your control:

string strAssembly = Type.GetType
("System.Object").Assembly.CodeBase.Replace
("mscorlib.dll","System.Windows.Forms.dll");

strAssembly = strAssembly.Replace("file:///", String.Empty);
strAssembly = System.Reflection.AssemblyName.GetAssemblyName
(strAssembly).FullName;

Type unmt = Type.GetType(System.Reflection.Assembly.CreateQualifiedName
(strAssembly, "System.Windows.Forms.UnsafeNativeMethods"));

Type ioot = unmt.GetNestedType("IOleObject");
System.Reflection.MethodInfo mi = ioot.GetMethod("GetClientSite");
object mySite = mi.Invoke(this, null);
try
{
this.myPapa = (Outlook.PropertyPageSite)mySite;
}
catch (System.Exception ee)
{
Base.WarnMessage(ee.ToString());
}


Cheers
Sunny

P.S. If you succeed to hook a help to all this, please, post how, I
still can not.
 

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