Introduction
This article give a small idea about how to start developing Microsoft Project application using Asp.net.As you all know microsoft project is tool used for creating schedules for projects.
Background
The new version of Microsoft Office�the 2007 Microsoft Office System�is a great platform on which to build composite applications. This system delivers not just the familiar set of Microsoft Office clients (Office Word, Office Excel, Office InfoPath), but also several key capabilities as services that are delivered on both client applications and the server. These services are not just packaged together into a monolithic unit, but are very compartmentalized (as shown in Figure 1), and each has its own Web services interfaces.
the high-level capabilities in the 2007 Microsoft Office System are listed in the following subsections. Each of these capabilities is a powerful feature, when looked at individually; however, it is the combination of these different technologies into a single integrated platform that makes composition practical. This integration enables delivery and deployment of composite applications without an overwhelming increase in complexity in the overall platform, tooling and, architecture.
Using this artcile i wil give you all small idea how to start developing microsoft project applicatioin using asp.net
Using the code
First Step
Add A reference of microsoft office project 12.0 Object Library
In solution explorer right click and select add reference.Then select COM components
and select microsoft office project 12.0 Object Library.then click OK.
Adding microsoft office project 12.0 Object Library in to visual studio.net using following line of code.
Imports Microsoft.Office.Interop.MSProject
Opening an Existing Project
Here we need to create an instance of Application object,then by using the function FileOpenEX in Application object,we can open the Project which we need to open and using application.visible=true to view the project file.
Dim appclass As New Application
appclass.FileOpenEx("C:\filename.mpp")
appclass.Visible = True
Create an object for interface project by using application.ActiveProject
Dim project As Project = appclass.ActiveProject
Adding A resource to a particular project
the code which need to use to add resources to a project is
project.Resources.Add("A", 1)
project.Resources.Add("B", 2)
project.Resources.Add("C", 3)
project.Resources.Add("D", 4)
project.Resources.Add("E", 5)
Adding tasks to a project
Here ,will give an idea of how to add a task to a particular project.Say for example if we want to add a new task named "Requirment Collection", you can achieve that by using
Dim task As Task = project.Tasks.Add("Requirment Collection")
Now we will assign a start and enddate to particular task.
task.Start = "08/1/2007"
task.Finish = "10/25/2007"
Now we wil add a resource to a particular project by
task.Assignments.Add(task.ID, 1)
task.Assignments.Add(task.ID, 2)
Now we wil set milestone to a project task by
task.Milestone = true/False
Then we need to tell whether this task is a main task or sub task by assigning value to the outline property
task.OutlineLevel
we can assign 1 or 2 or 3 depending the levelling of tasks.
Displaying different View of MS project
By using the project 12.0 library control we can display different type of views like Resource Graph,Network Diagram,Detail Gantt etc.
here is the code to display different type of views by using this line of code.
lets say if we want to show the resource graph
appclass.ViewApply("Resource Graph").
Same way if want to display network diagram we can use
appclass.ViewApply("Network Diagram").
similarly we can use below lines of codes to display different type of views.
appclass.ViewApply("Detail Gantt")
appclass.ViewApply("Leveling Gantt")
appclass.ViewApply("Tracking Gantt")
appclass.ViewApply("Task Sheet")
appclass.ViewApply("Descriptive Network Diagram")
appclass.ViewApply("Relationship Diagram")
Conclusion
In this article we have explored how to open a microsoft project ,adding tasks,adding resources and achieve some other tasks using asp.net.hope you all enjoy it..
About Ihsan
Ihsan is working as microsoft.net programmer for years .currently working in RANN CONSULTING SDN BHD malaysia.Mainly working on web ,mobile and pocketpc using Visual studio.