MspDbSettings Class

Allows to set necessary options to read project data from MS Project Server database.
Inheritance Hierarchy
SystemObject
  Aspose.Tasks.ConnectivityDbSettings
    Aspose.Tasks.ConnectivityMspDbSettings

Namespace:  Aspose.Tasks.Connectivity
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.10
Syntax
public class MspDbSettings : DbSettings

The MspDbSettings type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleMspDbSettings
Initializes a new instance of the MspDbSettings class.
Properties
  NameDescription
Public propertyCode exampleConnectionString
Gets or sets the connection string.
(Inherited from DbSettings.)
Public propertyCode exampleProjectGuid
Gets the guid of the project to read.
Public propertyCode exampleProviderInvariantName
Gets or sets provider invariant name which is used to get an instance of the DbProviderFactory class.
Remarks
Default value is System.Data.SqlClient.
(Inherited from DbSettings.)
Public propertyCode exampleSchema
Gets or sets the schema of the MS Project Server. The default value is "pub".
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to import a project from a database.
try
{
    // Create connection string
    var connectionString = new SqlConnectionStringBuilder();
    connectionString.DataSource = "192.168.56.2,1433";
    connectionString.Encrypt = true;
    connectionString.TrustServerCertificate = true;
    connectionString.InitialCatalog = "ProjectServer_Published";
    connectionString.NetworkLibrary = "DBMSSOCN";
    connectionString.UserID = "sa";
    connectionString.Password = "*****";

    // create settings to load from MS database
    var settings = new MspDbSettings(connectionString.ConnectionString, new Guid("E6426C44-D6CB-4B9C-AF16-48910ACE0F54"));
    settings.Schema = "dbo";

    Console.WriteLine("Project GUID to load: " + settings.ProjectGuid);

    var project = new Project(settings);

    project.Save(OutDir + "ImportProjectDataFromDatabase_out.mpp", SaveFileFormat.MPP);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message + " Please setup proper data source (DataSource, InitialCatalog etc)");
}
See Also