Class ProjectServerCredentials

Class ProjectServerCredentials

Namespace: Aspose.Tasks
Assembly: Aspose.Tasks.dll (25.2.0)

Credentials which are used to connect to Project Online or on-premise instance of Project Server.

public sealed class ProjectServerCredentials

Inheritance

objectProjectServerCredentials

Inherited Members

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

ProjectServerCredentials(string, string)

Initializes a new instance of the Aspose.Tasks.ProjectServerCredentials class using URL of SharePoint site and valid SPOIDCRL authorization token for SharePoint’s PWA (Project Web Access) site.

public ProjectServerCredentials(string siteUrl, string authToken)

Parameters

siteUrl string

The URL of PWA (Project Web Access) API of Project Online.

authToken string

The authorization token (SPOIDCRL) for SharePoint’s PWA (Project Web Access) site.

Remarks

Use this constructor to connect to ProjectOnline when you already have AuthToken for your SharePoint Online site.

ProjectServerCredentials(string, string, string)

Initializes a new instance of the Aspose.Tasks.ProjectServerCredentials class using URL of SharePoint site, user name and password.

public ProjectServerCredentials(string siteUrl, string userName, string password)

Parameters

siteUrl string

The URL of PWA (Project Web Access) API of Project Online.

userName string

The user name for the SharePoint site.

password string

The password for the SharePoint site.

Remarks

Use this constructor to connect to ProjectOnline. Please note that legacy authentication should be enabled in your Azure portal and Office 365 Admin center.

ProjectServerCredentials(string, NetworkCredential)

Initializes a new instance of the Aspose.Tasks.ProjectServerCredentials class using URL of Project Web Access endpoint and network credentials.

public ProjectServerCredentials(string siteUrl, NetworkCredential credentials)

Parameters

siteUrl string

The URL of project web access endpoint.

credentials NetworkCredential

The credentials used to login to Project Web Access endpoint.

Examples

In this example the instance of Aspose.Tasks.ProjectServerManager class is used to read a list of project from Project Server instance located at http://project_server_instance.local

csharp
string site = "http://project_server_instance.local/sites/pwa";
var windowsCredentials = new NetworkCredential("Administrator", "my_password", "DOMAIN");
var projectServerCredentials = new ProjectServerCredentials(site, windowsCredentials);
ProjectServerManager manager = new ProjectServerManager(projectServerCredentials);

var list = manager.GetProjectList();
foreach (var projectInfo in list)
{
    Console.WriteLine("{0} - {1} - {2}", projectInfo.Id, projectInfo.CreatedDate, projectInfo.Name);
}

Remarks

Use this constructor to connect to on-premise instance of Project Server via PWA.

Properties

AuthToken

Gets the authorization token for the SharePoint instance.

public string AuthToken { get; }

Property Value

string

SiteUrl

Gets the URL of PWA at SharePoint site or URL of on-premise Project Server. For example, https://your_company_name.sharepoint.com/sites/pwa";

public string SiteUrl { get; }

Property Value

string

UserName

Gets the user name for SharePoint site.

public string UserName { get; }

Property Value

string

Methods

ToString()

Returns a string representation of this instance.

public override string ToString()

Returns

string

a string representation of this instance.