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 - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

VSTO Outlook 2007



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 25th 09, 10:38 AM posted to microsoft.public.outlook.program_forms
manzoor
external usenet poster
 
Posts: 4
Default VSTO Outlook 2007

Hey I'm using C#, Visual Studio 2005 Professional. I installed VSTO 2005 SE
and its runtime from Microsoft Downloads.

I created a Outlook add-in and in it I added a User Control.

Its code is.

using System;
using System.Windows.Forms;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Runtime.InteropServices;


namespace OutlookAddIn1
{
public partial class UserControl1 : UserControl, Outlook.PropertyPage
{
const int captionDispID = -518;
bool isDirty = false;


public UserControl1()
{
InitializeComponent();
}

void Outlook.PropertyPage.Apply()
{
MessageBox.Show("The user clicked the Apply button");
}

bool Outlook.PropertyPage.Dirty
{
get
{
return isDirty;
}
}

void Outlook.PropertyPage.GetPageInfo(ref string helpFile, ref int
helpContext)
{
}

[DispId(captionDispID)]
public string PageCaption
{
get
{
return "Test Page";
}
}
}
}



Now in the ThisAddIn.cs file (main add in file)

the code is

using System;
using System.Windows.Forms;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Outlook = Microsoft.Office.Interop.Outlook;

namespace OutlookAddin1
{
public partial class ThisApplication
{ Outlook.NameSpace nameSpace;

private void ThisApplication_Startup(object sender, EventArgs e)
{
this.OptionsPageAdd += new
Outlook.ApplicationEvents_11_OptionsPagesAddEventH andler(
ThisApplication_OptionsPagesAdd);

nameSpace = this.Session;
nameSpace.OptionsPagesAdd += new
Outlook.NameSpaceEvents_OptionsPagesAddEventHandle r(
NameSpace_OptionsPagesAdd);
}

private void ThisApplication_Shutdown(object sender, EventArgs e)
{
}

void ThisApplication_OptionsPagesAdd(Outlook.PropertyPa ges pages)
{
pages.Add(new UserControl1(), "");
}

void NameSpace_OptionsPagesAdd(Outlook.PropertyPages pages,
Outlook.MAPIFolder folder)
{
pages.Add(new UserControl1(), "");
}

#region VSTO Designer generated code
private void InternalStartup()
{
this.Startup += new EventHandler(ThisApplication_Startup);
this.Shutdown += new EventHandler(ThisApplication_Shutdown);
}
#endregion
}
}




The code is from a book and I get the following errors
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.Designer.cs(71,18): error
CS0117: 'OutlookAddIn1.ThisAddIn' does not contain a definition for
'InternalStartup'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(14,18): error CS0117:
'OutlookAddin1.ThisApplication' does not contain a definition for
'OptionsPageAdd'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(18,30): error CS0117:
'OutlookAddin1.ThisApplication' does not contain a definition for 'Session'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(30,27): error CS0246:
The type or namespace name 'UserControl1' could not be found (are you missing
a using directive or an assembly reference?)
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(30,13): error CS1502:
The best overloaded method match for
'Microsoft.Office.Interop.Outlook.PropertyPages.Ad d(object, string)' has some
invalid arguments
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(30,23): error CS1503:
Argument '1': cannot convert from 'UserControl1' to 'object'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(36,27): error CS0246:
The type or namespace name 'UserControl1' could not be found (are you missing
a using directive or an assembly reference?)
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(36,13): error CS1502:
The best overloaded method match for
'Microsoft.Office.Interop.Outlook.PropertyPages.Ad d(object, string)' has some
invalid arguments
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(36,23): error CS1503:
Argument '1': cannot convert from 'UserControl1' to 'object'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(42,18): error CS0117:
'OutlookAddin1.ThisApplication' does not contain a definition for 'Startup'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(43,18): error CS0117:
'OutlookAddin1.ThisApplication' does not contain a definition for 'Shutdown'


What am I doing wrong?




Ads
  #2  
Old February 25th 09, 03:12 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default VSTO Outlook 2007

That's not code for a VSTO 2005 SE addin, it's code for a VSTO 2005 addin.

You have either the wrong version of VSTO installed or are using addin code
for the earlier version.

ThisApplication_Startup() is from VSTO 2005, in VSTO 2005 SE it would be
ThisAddin_Startup().

--
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


"manzoor" wrote in message
news
Hey I'm using C#, Visual Studio 2005 Professional. I installed VSTO 2005
SE
and its runtime from Microsoft Downloads.

I created a Outlook add-in and in it I added a User Control.

Its code is.

using System;
using System.Windows.Forms;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Runtime.InteropServices;


namespace OutlookAddIn1
{
public partial class UserControl1 : UserControl, Outlook.PropertyPage
{
const int captionDispID = -518;
bool isDirty = false;


public UserControl1()
{
InitializeComponent();
}

void Outlook.PropertyPage.Apply()
{
MessageBox.Show("The user clicked the Apply button");
}

bool Outlook.PropertyPage.Dirty
{
get
{
return isDirty;
}
}

void Outlook.PropertyPage.GetPageInfo(ref string helpFile, ref int
helpContext)
{
}

[DispId(captionDispID)]
public string PageCaption
{
get
{
return "Test Page";
}
}
}
}



Now in the ThisAddIn.cs file (main add in file)

the code is

using System;
using System.Windows.Forms;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Outlook = Microsoft.Office.Interop.Outlook;

namespace OutlookAddin1
{
public partial class ThisApplication
{ Outlook.NameSpace nameSpace;

private void ThisApplication_Startup(object sender, EventArgs e)
{
this.OptionsPageAdd += new
Outlook.ApplicationEvents_11_OptionsPagesAddEventH andler(
ThisApplication_OptionsPagesAdd);

nameSpace = this.Session;
nameSpace.OptionsPagesAdd += new
Outlook.NameSpaceEvents_OptionsPagesAddEventHandle r(
NameSpace_OptionsPagesAdd);
}

private void ThisApplication_Shutdown(object sender, EventArgs e)
{
}

void ThisApplication_OptionsPagesAdd(Outlook.PropertyPa ges pages)
{
pages.Add(new UserControl1(), "");
}

void NameSpace_OptionsPagesAdd(Outlook.PropertyPages pages,
Outlook.MAPIFolder folder)
{
pages.Add(new UserControl1(), "");
}

#region VSTO Designer generated code
private void InternalStartup()
{
this.Startup += new EventHandler(ThisApplication_Startup);
this.Shutdown += new EventHandler(ThisApplication_Shutdown);
}
#endregion
}
}




The code is from a book and I get the following errors
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.Designer.cs(71,18):
error
CS0117: 'OutlookAddIn1.ThisAddIn' does not contain a definition for
'InternalStartup'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(14,18): error
CS0117:
'OutlookAddin1.ThisApplication' does not contain a definition for
'OptionsPageAdd'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(18,30): error
CS0117:
'OutlookAddin1.ThisApplication' does not contain a definition for
'Session'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(30,27): error
CS0246:
The type or namespace name 'UserControl1' could not be found (are you
missing
a using directive or an assembly reference?)
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(30,13): error
CS1502:
The best overloaded method match for
'Microsoft.Office.Interop.Outlook.PropertyPages.Ad d(object, string)' has
some
invalid arguments
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(30,23): error
CS1503:
Argument '1': cannot convert from 'UserControl1' to 'object'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(36,27): error
CS0246:
The type or namespace name 'UserControl1' could not be found (are you
missing
a using directive or an assembly reference?)
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(36,13): error
CS1502:
The best overloaded method match for
'Microsoft.Office.Interop.Outlook.PropertyPages.Ad d(object, string)' has
some
invalid arguments
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(36,23): error
CS1503:
Argument '1': cannot convert from 'UserControl1' to 'object'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(42,18): error
CS0117:
'OutlookAddin1.ThisApplication' does not contain a definition for
'Startup'
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddI n.cs(43,18): error
CS0117:
'OutlookAddin1.ThisApplication' does not contain a definition for
'Shutdown'


What am I doing wrong?





 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
outlook 2007 vsto C# manzoor Outlook - Using Forms 1 February 24th 09 03:43 PM
Extract and replace the email's body (VSTO, Outlook 2007) thomas.schager@gmail.com Add-ins for Outlook 1 October 3rd 07 03:02 PM
Upgraded Outlook to 2007, now VSTO doesn't work HÃ¥kan Outlook and VBA 1 August 28th 07 02:19 PM
Outlook 2007 Add-in using VSTO 2005 SE Kenn Outlook - Using Forms 1 November 4th 06 03:27 AM
VSTO Backwards compatibility with Outlook 2003 / 2007 abcomp Add-ins for Outlook 1 July 19th 06 04:14 PM


All times are GMT +1. The time now is 12:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.