A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , ,

Property Page is not loaded on Vista





 
 
Thread Tools Display Modes
  #1  
Old December 5th 07, 12:53 PM posted to microsoft.public.outlook.program_vba
Dhananjay
external usenet poster
 
Posts: 31
Default Property Page is not loaded on Vista

Hi All,
I have developed one COM-Addin in vb 2005 / VSTO / Office 2007. I have
added one property page to the options page. My addin loads perfectly
with the correct option page, on any platform for many machines. i.e.
my addin works for Vista, xP, 2003 server etc. with office 2007
installed on it. My property page is also loading perfectly. But on
some machine with Office 2007 / Vista, I can not click on my property
page. I get error - "Cannot display "Custom" page. This page will
remain visible, but is not available".
To display property page I have included one form which Inherits from
System.Windows.Forms.UserControl & Implements
Microsoft.Office.Interop.Outlook.PropertyPage. & in my
Application_OptionPagesAdd event, I added the line
Pages.Add("Custom.PropPage", "Custom Title"). Also in my trace file I
can see the trace before & after "Pages.add ..." line & also
proppage_load event's trace. But when someone clicks on the tab, he is
greeted with this error & also my trace file contains
Application_optionPagesAdd trace & doesn't contain PropPage_Load
events trace statements at all.
As I mentioned before, my addin is working fine on all machines with
platforms XP, 2k3 , Vista etc, but on some machines (Office 2007 with
Vista), only I am getting this error.

So what should I check on those machines specifically?

Thanks in advance,
Dhananjay
Ads
  #2  
Old December 5th 07, 03:41 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,793
Default Property Page is not loaded on Vista

Usually when that error occurs it means either the property page control
isn't registered for OCX controls or there was an error in that page. Are
you sure that all controls you used that might need to be deployed to the
target systems are actually deployed and registered on those computers where
the property page display fails?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dhananjay" wrote in message
...
Hi All,
I have developed one COM-Addin in vb 2005 / VSTO / Office 2007. I have
added one property page to the options page. My addin loads perfectly
with the correct option page, on any platform for many machines. i.e.
my addin works for Vista, xP, 2003 server etc. with office 2007
installed on it. My property page is also loading perfectly. But on
some machine with Office 2007 / Vista, I can not click on my property
page. I get error - "Cannot display "Custom" page. This page will
remain visible, but is not available".
To display property page I have included one form which Inherits from
System.Windows.Forms.UserControl & Implements
Microsoft.Office.Interop.Outlook.PropertyPage. & in my
Application_OptionPagesAdd event, I added the line
Pages.Add("Custom.PropPage", "Custom Title"). Also in my trace file I
can see the trace before & after "Pages.add ..." line & also
proppage_load event's trace. But when someone clicks on the tab, he is
greeted with this error & also my trace file contains
Application_optionPagesAdd trace & doesn't contain PropPage_Load
events trace statements at all.
As I mentioned before, my addin is working fine on all machines with
platforms XP, 2k3 , Vista etc, but on some machines (Office 2007 with
Vista), only I am getting this error.

So what should I check on those machines specifically?

Thanks in advance,
Dhananjay



  #3  
Old December 6th 07, 06:44 AM posted to microsoft.public.outlook.program_vba
Dhananjay
external usenet poster
 
Posts: 31
Default Property Page is not loaded on Vista

Hi Ken,
Thanks for your valuable reply.
First of all, I have not added any external ocx for property page( If
my class inherits from UserControl & implements PropertyPage and then
it is said to be ocx, i don't know abt it.). Further I have not used
any other external control on the propertypage. my code snippet for
property page load is as follows -

AddTrace("Property page is loading ...")
Dim myType As Type = GetType(System.Type)
Dim assembly As String =
System.Text.RegularExpressions.Regex.Replace(myTyp e.Assembly.CodeBase,
"mscorlib.dll", "System.Windows.Forms.dll")
assembly =
System.Text.RegularExpressions.Regex.Replace(assem bly, "file:///", "")
assembly =
System.Reflection.AssemblyName.GetAssemblyName(ass embly).FullName
Dim unmanaged As Type =
Type.GetType(System.Reflection.Assembly.CreateQual ifiedName(assembly,
"System.Windows.Forms.UnsafeNativeMethods"))
Dim oleObj As Type = unmanaged.GetNestedType("IOleObject")
Dim mi As System.Reflection.MethodInfo =
oleObj.GetMethod("GetClientSite")
Dim myprop As Object = mi.Invoke(Me, Nothing)
myPropSite = TryCast(myprop,
Microsoft.Office.Interop.Outlook.PropertyPageSite)
If myPropSite Is Nothing Then
AddTrace("Error - Site not Loaded")
MsgBox("Site not loaded")
GoTo AtEnd
Else
AddTrace("Site Loaded successfully")
blnDirty = False
End If
AddTrace("Option page loaded")

The all code above I got from one site (I don't remember the site
name). But if this code is having prob, pl guide me.

Thanks again,
Dhananjay
On Dec 5, 7:41 pm, "Ken Slovak - [MVP - Outlook]"
wrote:
Usually when that error occurs it means either the property page control
isn't registered for OCX controls or there was an error in that page. Are
you sure that all controls you used that might need to be deployed to the
target systems are actually deployed and registered on those computers where
the property page display fails?

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm

"Dhananjay" wrote in message

...



Hi All,
I have developed one COM-Addin in vb 2005 / VSTO / Office 2007. I have
added one property page to the options page. My addin loads perfectly
with the correct option page, on any platform for many machines. i.e.
my addin works for Vista, xP, 2003 server etc. with office 2007
installed on it. My property page is also loading perfectly. But on
some machine with Office 2007 / Vista, I can not click on my property
page. I get error - "Cannot display "Custom" page. This page will
remain visible, but is not available".
To display property page I have included one form which Inherits from
System.Windows.Forms.UserControl & Implements
Microsoft.Office.Interop.Outlook.PropertyPage. & in my
Application_OptionPagesAdd event, I added the line
Pages.Add("Custom.PropPage", "Custom Title"). Also in my trace file I
can see the trace before & after "Pages.add ..." line & also
proppage_load event's trace. But when someone clicks on the tab, he is
greeted with this error & also my trace file contains
Application_optionPagesAdd trace & doesn't contain PropPage_Load
events trace statements at all.
As I mentioned before, my addin is working fine on all machines with
platforms XP, 2k3 , Vista etc, but on some machines (Office 2007 with
Vista), only I am getting this error.


So what should I check on those machines specifically?


Thanks in advance,
Dhananjay- Hide quoted text -


- Show quoted text -


  #4  
Old December 6th 07, 03:19 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,793
Default Property Page is not loaded on Vista

With managed code you don't have to have a separate OCX for the property
page, an OCX is an ActiveX control, that's how it's done in unmanaged code.
However, if you aren't using any special controls on your property page user
control (like a 3rd party grid control for example) and not compiling a
separate unmanaged OCX then those usual causes don't apply obviously.

If the code you're using works on some target computers (other than the dev
machine and any others with Visual Studio installed) then it's down to
what's different on the computers where it works and where it doesn't work.
I'd be looking at the Framework security setup on the affected machines as
opposed to where it works, any dependencies in the project to make sure they
exist or are deployed and possibly adding lots of logging code to see
exactly which code line is firing the exception.

Another thing you can try is one of the sample projects (for Outlook 2007)
on my Web site at http://www.slovaktech.com/outlook_2007_templates.htm. I
have totally basic property pages in those projects that you can test and
see if they work on the problem computers if they're running Outlook 2007.
The property page code I used isn't specific to Outlook 2007, so you can use
something like what I have even for Outlook 2003 as a test if you put it in
an Outlook 2003 COM addin project.

The code I use to get the Site in the page startup is very similar to the
code you're using, here's what I use:

Imports Outlook = Microsoft.Office.Interop.Outlook
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.ComponentModel

Public Class ToolsOptionsPP
Implements Outlook.PropertyPage

Private m_dirty As Boolean
Private m_site As Outlook.PropertyPageSite

Private m_caption As String

Public Sub Apply() Implements
Microsoft.Office.Interop.Outlook.PropertyPage.Appl y
If m_dirty Then
'do something to save properties

'clear the dirty flag
m_dirty = False
End If
End Sub

Public ReadOnly Property Dirty() As Boolean Implements
Microsoft.Office.Interop.Outlook.PropertyPage.Dirt y
Get
Dirty = m_dirty
End Get
End Property

Public Sub GetPageInfo(ByRef HelpFile As String, ByRef HelpContext As
Integer) Implements
Microsoft.Office.Interop.Outlook.PropertyPage.GetP ageInfo
'show help file here
End Sub

Private Sub ToolsOptionsPP_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
' HACK: uses reflection to call a private unsafe method!
Dim userControlType As Type = GetType(Windows.Forms.UserControl)

Dim oleObjectType As Type =
userControlType.Assembly.GetType("System.Windows.F orms.UnsafeNativeMethods+IOleObject")

Dim method As MethodInfo = oleObjectType.GetMethod("GetClientSite")

m_site = TryCast(method.Invoke(Me, Nothing),
Outlook.PropertyPageSite)

End Sub

Private Sub SetDirty()
m_dirty = True

If m_site IsNot Nothing Then
m_site.OnStatusChange()
End If
End Sub

Protected Overrides Sub Finalize()
m_site = Nothing

MyBase.Finalize()
End Sub

DispId(-518) _
Public Property Caption() As String
' Return the OptionsPage Caption here.
Get
Return m_caption
End Get

Set(ByVal value As String)
m_caption = value
End Set
End Property
End Class

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dhananjay" wrote in message
...
Hi Ken,
Thanks for your valuable reply.
First of all, I have not added any external ocx for property page( If
my class inherits from UserControl & implements PropertyPage and then
it is said to be ocx, i don't know abt it.). Further I have not used
any other external control on the propertypage. my code snippet for
property page load is as follows -

AddTrace("Property page is loading ...")
Dim myType As Type = GetType(System.Type)
Dim assembly As String =
System.Text.RegularExpressions.Regex.Replace(myTyp e.Assembly.CodeBase,
"mscorlib.dll", "System.Windows.Forms.dll")
assembly =
System.Text.RegularExpressions.Regex.Replace(assem bly, "file:///", "")
assembly =
System.Reflection.AssemblyName.GetAssemblyName(ass embly).FullName
Dim unmanaged As Type =
Type.GetType(System.Reflection.Assembly.CreateQual ifiedName(assembly,
"System.Windows.Forms.UnsafeNativeMethods"))
Dim oleObj As Type = unmanaged.GetNestedType("IOleObject")
Dim mi As System.Reflection.MethodInfo =
oleObj.GetMethod("GetClientSite")
Dim myprop As Object = mi.Invoke(Me, Nothing)
myPropSite = TryCast(myprop,
Microsoft.Office.Interop.Outlook.PropertyPageSite)
If myPropSite Is Nothing Then
AddTrace("Error - Site not Loaded")
MsgBox("Site not loaded")
GoTo AtEnd
Else
AddTrace("Site Loaded successfully")
blnDirty = False
End If
AddTrace("Option page loaded")

The all code above I got from one site (I don't remember the site
name). But if this code is having prob, pl guide me.

Thanks again,
Dhananjay


  #5  
Old December 7th 07, 06:29 AM posted to microsoft.public.outlook.program_vba
Dhananjay
external usenet poster
 
Posts: 31
Default Property Page is not loaded on Vista

Hi Ken,
Thanks for your reply.
I downloaded your sample project from http://www.slovaktech.com/outlook_2007_templates.htm
viz. "VSTO 2005 SE VB.NET Addin Project". Your addin shows me one menu
bar & in that, one test button. Also I can see your tab in Tools -
Options page. Hence while debugging control goes to
Application_OptionsPagesAdd
, but now when I click on ur tab, it doesn't give me any error message
or control doesn't go to "ToolsOptionsPP_Load" :-( . This is my
developement machine with Win XP, Office 2k7 , Visual Studio 2005.
What may be the problem with my machine?
Thanks for ur patience!

Dhananajy
  #6  
Old December 7th 07, 02:42 PM posted to microsoft.public.outlook.program_vba
Dhananjay
external usenet poster
 
Posts: 31
Default Property Page is not loaded on Vista

Hi Ken,
Further I need some clarifications from you.
1 Framework security setup : What is it? How can I check it? Can it
be fixed by installing .net framework again?
2 Dependencies in the project to make sure they exist or are
deployed : Actually I am confused with this part. I have checked my
addin on clean Vista machine without any development platform on it.
It worked for me. For that , I used totally formatted disk to install
Vista & office 2007. So my thinking is that I am deploying all the
necessary files to client machine.
3 Possibly adding lots of logging code : I have added trace after
each line. But as I said before, I can see the trace for
Applications_PagesAdd only & not a single line from Page_Load method.

Thanks again!
Dhananjay
  #7  
Old December 7th 07, 03:47 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,793
Default Property Page is not loaded on Vista

Framework security should be set by the installer package or manually using
the Framework configuration utility. It's not set by installing or
reinstalling the Framework. For a VSTO addin you need to have full trust set
up for your addin assemblies. That's usually done with the SetSecurity
project as detailed at
http://msdn2.microsoft.com/en-us/library/bb332051.aspx. Those articles also
have information about deploying on Vista, and there's more information
about deployments at http://www.outlookcode.com/article.aspx?ID=42. I'd
suggest carefully studying all the information available at those locations.

If the addin sample from my Web site is working for you then it's a matter
of comparing your code and deployment with the sample and seeing what's
different. I can't do that for you.

If the property page is displaying on some systems and not on others then
you have to try and find out what's different. Again that's detective work
you'll have to do.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dhananjay" wrote in message
...
Hi Ken,
Further I need some clarifications from you.
1 Framework security setup : What is it? How can I check it? Can it
be fixed by installing .net framework again?
2 Dependencies in the project to make sure they exist or are
deployed : Actually I am confused with this part. I have checked my
addin on clean Vista machine without any development platform on it.
It worked for me. For that , I used totally formatted disk to install
Vista & office 2007. So my thinking is that I am deploying all the
necessary files to client machine.
3 Possibly adding lots of logging code : I have added trace after
each line. But as I said before, I can see the trace for
Applications_PagesAdd only & not a single line from Page_Load method.

Thanks again!
Dhananjay


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Property page not loaded in Office 2007 Dhananjay Outlook and VBA 1 November 19th 07 03:11 PM
Property Page back color Mike Add-ins for Outlook 1 September 26th 07 07:01 PM
Background Color for Outlook Property Page paulmcd Add-ins for Outlook 2 February 15th 06 08:38 AM
How to validate a Custom Property Page Jack Zhang Add-ins for Outlook 1 February 9th 06 08:22 PM
why can't you add a page to a form just like you can add a page to the property page donald Outlook - Using Forms 2 January 25th 06 11:50 AM


All times are GMT +1. The time now is 12:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Credit Cards - Internet Advertising - Equity Release - 0 Credit Cards - Car Loans