Read or Create Projects on Project Server and Project Online using C# .NET

Project Server and Project Online in C# ASP.NET

The Project Online and Project Server are the feature-rich project and portfolio management solutions provided by Microsoft. Both the solutions offer almost a similar range of features for creating and managing projects, however, they differ based on which solution fits well with your requirements. For example, if you want the on-premise solution with more control over the hardware and software then you may opt Project Server. On the other hand, Project Online serves as a cloud-based instance of Project Server without requiring your own infrastructure.

There might be the case when to need to access the information of the projects from Project Server/Online from within your applications. In order to deal with such cases, in this article, I’ll show you how to create/read the projects on/from Project Server or Project Online within your .NET applications (ASP.NET, etc.) or web services using C#.

C# API for Project Server/Online

For creating the new projects and reading the existing ones from Project Server/Online, we’ll use Aspose.Tasks for .NET. It is a cross-platform class library for reading and writing MS Project files programmatically in .NET Standard or .NET Core applications. The API is hosted on NuGet as well as available as an MSI package and zipped DLL in the Downloads section.

Working with Project Server

In this section, I’ll show you how to connect to the Project Server and read or create the projects. In order to connect to the Project Server, you need to know the following details:

  • Project Server’s URL i.e. https://contoso.sharepoint.com
  • Domain i.e. contoso.com
  • Username
  • Password

Read Projects from Project Server in C#

The following are the steps to connect to Project Server and retrieve the projects list from it.

The following code sample shows how to read projects from Project Server in C#.

Create Project on Project Server in C#

Creating a project on Project Server is as simple as pie. Simply connect to Project Server in the same way you have done in the previous example, load the project file (.mpp) using Project class and call ProjectServerManager.CreateNewProject() method.

The following code sample shows how to create a new project on Project Server in C#.

Working with Project Online

Working with Project Online is quite similar to working with Project Server and it only differs in creating the connection. In order to connect to Project Online, you need to know the following details:

  • URL
  • Username
  • Password

Read Projects from Project Online in C#

The following are the steps to read projects from Project Online:

The following code sample shows how to retrieve the list of projects from Project Online.

Create a Project on Project Online in C#

The following are the steps to create a new project on Project Online:

The following code sample shows how to create a new project on Project Online in C#.

Learn more about Aspose.Tasks for .NET

You can learn more about project management using Aspose.Tasks for .NET from the documentation.