共用方式為


Admin.ReadServerVersion 方法

主要、 Project Server 版本可讀取次要組建和修訂編號。

命名空間:  WebSvcAdmin
組件:  ProjectServerServices (在 ProjectServerServices.dll 中)

語法

'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Admin/ReadServerVersion", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Admin/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Admin/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadServerVersion As DataSet
'用途
Dim instance As Admin
Dim returnValue As DataSet

returnValue = instance.ReadServerVersion()
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Admin/ReadServerVersion", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Admin/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Admin/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public DataSet ReadServerVersion()

傳回值

類型:System.Data.DataSet
DataSet包含名為ServerVersion和一列與欄名稱WADMIN_VERSION_MAJOR、 WADMIN_VERSION_MINOR、 WADMIN_VERSION_BUILD及WADMIN_VERSION_REVISION單一表格。

備註

Project Server 權限

權限

描述

LogOn

可讓使用者登入 Project Server。通用權限。

範例

ProjectServerVersion範例方法會傳回合併表格中的所有四個欄位的字串。

using System;
using System.Data;
. . .
public string ProjectServerVersion(SvcAdmin.Admin admin)
{
    string major, minor, build, revision;
    string version = "";

    DataSet dsInfo = admin.ReadServerVersion();

    DataRow row = dsInfo.Tables["ServerVersion"].Rows[0];
    major = row["WADMIN_VERSION_MAJOR"].ToString();
    minor = row["WADMIN_VERSION_MINOR"].ToString();
    build = row["WADMIN_VERSION_BUILD"].ToString();
    revision = row["WADMIN_VERSION_REVISION"].ToString();

    build = build.Insert(build.Length - 4, ".");

    version = major + "." +
        minor + "." +
        build + ", rev. " +
        revision;
    return version;
}

在範例中,為AdminWebSvcPSI 管理 Web 服務命名空間。admin參數,則類別變數,定義在呼叫類別中,如下:

public static AdminWebSvc.Admin admin = new WebSvcAdmin.Admin();
. . .
    string ver = ProjectServerVersion(admin);

例如, ProjectServerVersion會傳回下列字串Microsoft Project Server 2010的發行版本: 14.0.4750.1000, rev. 15

請參閱

參照

Admin 類別

Admin 成員

WebSvcAdmin 命名空間