GetProjectServerSettings Method

Retrieves settings from Project Server by calling the Project Server server-side object. The method supports retrieving global Project Server settings, settings specific to the active project, or settings specific to the current project manager. The method can take as an argument an XML stream specifying the settings the requester is interested in. It returns an XML stream containing the values for these settings.

Syntax

expression**.GetProjectServerSettings(RequestXML, Project)**

*expression   *     Required. An expression that returns an Application object.

XML stream

The XML for the RequestXML argument is as follows:

<ProjectServerSettingsRequest>
    <AdminDefaultTrackingMethod />
    <AdminTrackingLocked />
    <ProjectIDInProjectServer />
    <ProjectManagerHasTransactions />
    <ProjectManagerHasTransactionsForCurrentProject />
    <TimePeriodGranularity />
    <GroupsForCurrentProjectManager />
</ProjectServerSettingsRequest>

Note  In the XML stream for RequestXML, you only need to include the arguments you are interested in. For example, if you only want to retrieve the AdminDefaultTrackingMethod, you would use the following XML stream for the RequestXML argument:

<ProjectServerSettingsRequest>
    <AdminDefaultTrackingMethod />
</ProjectServerSettingsRequest>

The individual elements return the following values:

AdminDefaultTrackingMethod.    The default tracking method the administrator has set up on Project Server: hours of work done per day or per week (1), percent of work complete (2), or actual work done and work remaining (3).

AdminTrackingLocked.    A Boolean value indicating whether the administrator has locked down the tracking method on Project Server. A False value (0) allows project managers to change the default method for reporting progress if a different method is appropriate for a specific project, and a True value (1) forces project managers to use the progress reporting method specified by the administrator for all projects.

ProjectIDInProjectServer.    The project ID in the Project Server database for the current project.

ProjectManagerHasTransactions.    The number of pending transactions the project manager has in Project Web Access.

ProjectManagerHasTransactionsForCurrentProject.    The number of pending transactions for the current project the project manager has in Project Web Access.

TimePeriodGranularity.    The defaults the administrator has set up for the intervals displayed in the Project Web Access time sheet: resources should report their total hours worked during the entire time period that the administrator has set up as the default (0), resources should report their hours worked every day (1), or resources should report their total hours worked for a week (2).

following format

<ProjectServerSettingsReturn>
   <GroupsForCurrentProjectManager>
      <ProjectServerGroup>Name of first group that user belongs to
      </ProjectServerGroup>
      <ProjectServerGroup>Name of nth group that user belongs to
      </ProjectServerGroup>
   </GroupsForCurrentProjectManager>
</ProjectServerSettingsReturn>

Project    Optional Object. A pointer to the Project object for the project the user is interested in retrieving settings for.

Remarks

The method requires user authentication against Project Server, so if the user has not been authenticated within the current session, and if authentication cannot be done automatically by using Windows Authentication, the Project Server Accounts dialog box appears. When the user is authenticated, the authentication information should persist within the current session.

The GetProjectServerSettings method returns an XML stream containing the values for the settings specified in the RequestXML argument. For example, if a user requests GroupsForCurrentProjectManager with the RequestXML argument, the method returns the following XML:

<ProjectServerSettingsReturn>
    <GroupsForCurrentProjectManager>
    <ProjectServerGroup>
    Name of group1 that the user belongs to
    </ProjectServerGroup>
    ...
    <ProjectServerGroup>
    Name of the groupn that user belongs to
    </ProjectServerGroup>
    </GroupsForCurrentProjectManager>
</ProjectServerSettingsReturn>

Example

The following sample returns an XML stream representing all the available settings listed above from Project Server.

Sub mpsSettings()
   URL = ActiveProject.ServerURL
   If Application.GetProjectServerVersion(URL) = pjServerVersionInfo_P10 Then
      ActiveProject.MakeServerURLTrusted
      xmlStream = Application.GetProjectServerSettings( _
      RequestXML:="<ProjectServerSettingsRequest>" _
         & "<AdminDefaultTrackingMethod /><AdminTrackingLocked />" _
         & "<ProjectIDInProjectServer />" _
         & "<ProjectManagerHasTransactions />" _
         & "<ProjectManagerHasTransactionsForCurrentProject />" _
         & "<TimePeriodGranularity /><GroupsForCurrentProjectManager />" _
         & "</ProjectServerSettingsRequest>")
      MsgBox xmlStream
   Else
      MsgBox "This macro returns information from Project " _
         & "Server. Please choose 'Collaborate using Project " _
         & "Server' and specify a valid Project Server URL " _
         & "for this project in Collaboration Options (Collaborate menu)."
      Exit Sub
   End If
End Sub

Applies to | Application Object

See Also | GetProjectServerVersion Method | UpdateFromProjectServer Method