com.aspose.tasks

Interfaces

Classes

Exceptions

com.aspose.tasks

Class ProjectServerCredentials



  • public final class ProjectServerCredentials
    extends Object

    Credentials which are used to connect to Project Online.

    • Constructor Detail

      • ProjectServerCredentials

        public ProjectServerCredentials(String siteUrl,
                                        String authToken)

        Initializes a new instance of the ProjectServerCredentials class using url of sharepoint site and valid authorization token for sharepoint site.

        Parameters:
        siteUrl - The url of sharepoint site. For example, https://your_company_name.sharepoint.com"
        authToken - The authorization token for sharepoint. See AuthToken(getAuthToken()/setAuthToken(String)) property description.
      • ProjectServerCredentials

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

        Initializes a new instance of the ProjectServerCredentials class using url of sharepoint site, user name and password.

        Parameters:
        siteUrl - The url of sharepoint site. For example, https://your_company_name.sharepoint.com"
        userName - The user name for the sharepoint site.
        password - The password for the sharepoint site.
    • Method Detail

      • getAuthToken

        public final String getAuthToken()

        Gets the authorization token for the SharePoint. Can be retrieved using SharePointOnlineCredentials class from Microsoft.SharePoint.Client.Runtime assembly (in Microsoft.SharePoint.Client.Runtime.dll).

         Uri siteUrl = new Uri("https://your_company_name.sharepoint.com");
         var username = "your.login@nstincorporated.onmicrosoft.com";
         SecureString password = new SecureString();
          var pwdS = "your_password";
         foreach (char c in pwdS)
         {
             password.AppendChar(c);
         }
         var onlineCredentials = new SharePointOnlineCredentials(username, password);
         var fedAuthTicket = onlineCredentials.GetAuthenticationCookie(siteUrl, true);
         var projectOnlineCredentials = new ProjectServerCredentials(siteUrl.ToString(), fedAuthTicket);
         
        Returns:
        the authorization token for the SharePoint.
      • getSiteUrl

        public final String getSiteUrl()

        Gets the URL of the sharepoint site. For example, https://your_company_name.sharepoint.com";

        Returns:
        the URL of the sharepoint site.
      • getUserName

        public final String getUserName()

        Gets the user name for sharepoint site

        Returns:
        the user name for sharepoint site