VSTO Add-In Support for Project 2003 and Project 2007
I am very excited about the Visual Studio Beta 2 release, as it now has support for Project 2003 and Project 2007 add-ins! This makes coding and debugging managed code very easy in Project Client. It also makes it really simple to call into the PSI from Project Client to retrieve and update data on the server because you have the complete .Net framework at your disposal.
You can download Visual Studio Beta 2 to try it out for yourself:
https://msdn2.microsoft.com/en-us/vstudio/default.aspx
I plan to do a few complex blog posts with regards to VSTO over the next couple of months, but to get started, here is a basic example:
1. Download and install VS Beta 2 from: https://msdn2.microsoft.com/en-us/vstudio/default.aspx
2. Open VS Beta 2 and Create a New Project selecting Project Add-in:
3. Give it a name and click OK
4. Add a Windows Form called SimpleDemoForm to the project:
5. A label to the form called: lblProjectName
6. In the ThisAddIn.cs class file add the following code in the startup method:
SimpleDemoForm frmSimpleDemoForm = new SimpleDemoForm(Application);
frmSimpleDemoForm.Show();
This code will load and show the form we created in step 4. Note that we pass the Application into the form's constructor.
7. View the code for the form and have it match the following:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MSProject = Microsoft.Office.Interop.MSProject;
namespace SimpleDemo
{
public partial class SimpleDemoForm : Form
{
private MSProject.Application Application;
public SimpleDemoForm(MSProject.Application Application)
{
InitializeComponent();
this.Application = Application;
}
private void SimpleDemoForm_Load(object sender, EventArgs e)
{
lblProjectName.Text = Application.ActiveProject.Name;
}
}
}
Couple of things to note with this code sample. We have referenced Microsoft.Office.Interop.MSProject and we have passed the Application variable to the form so that we can manipulate the project in the same way we can manipulate it in VBA. In the form load method, we read the project name and show it on the form.
8. Build and run the application.
This should launch Project automatically and load the add-in for you, with no configuration work involved. You can also add any debug breaks to troubleshoot your code.
Here is what you should see when you build and run the add-in:
Chris Boyd
Comments
Anonymous
August 02, 2007
Please find below sample code (thank you Mike Shughrue) in C# for a Project Professional 2007 COM Add-in.Anonymous
August 02, 2007
Please find below sample code (thank you Mike Shughrue) in C# for a Project Professional 2007 COM AddAnonymous
August 13, 2007
Hi, Can someone state the major advantage of using VSTO instead of current VS template to create an Add-in?Anonymous
August 21, 2007
VSTO in Visual Studio 2008 provides add-in templates for Project 2003 and 2007, as well as easier integration with the other Office applications. Publishing the add-in to a network share with ClickOnce makes it very easy to distribute the add-in, handle security, and manage prerequisites and updates.Anonymous
August 24, 2007
I just downloaded the Beta2 and installed the same just to get the first hand on VSTO for MSProject 2007. But after I installed VS 2008, i do not see the "Project Addin" entry in VS's New Project Dialog. (I do see entries for Word / excel etc) I have MSP 2007 installed. I have also installed PIO assemblies for 2007 just in case if its required. Any clue?Anonymous
February 06, 2008
罗列VSTO网络资源,还有使用VSTO做Project开发时遇到的问题Anonymous
August 05, 2008
I need to get the values of a Lookup tables in COM add-in. How can i get it .. I am using Project server 2007 and project prof. 2007. I tried with CustomFieldValueListGetItem method.. But i cannot get the required result.. please anybody help me to get all the values of a Lookup table using COM add-inAnonymous
August 20, 2012
The comment has been removedAnonymous
August 20, 2012
For help with VSTO development in Project, please search for similar issues in the Project Customization and Programming forum, or ask a question there. social.msdn.microsoft.com/.../threads