共用方式為


PSClientError 類別

包含的 SOAP 例外規則 PSI 方法的相關資訊。

繼承階層架構

System.Object
  Microsoft.Office.Project.Server.Library.PSClientError

命名空間:  Microsoft.Office.Project.Server.Library
組件:  Microsoft.Office.Project.Server.Library (在 Microsoft.Office.Project.Server.Library.dll 中)

語法

'宣告
<SerializableAttribute> _
Public Class PSClientError _
    Implements ISerializable
'用途
Dim instance As PSClientError
[SerializableAttribute]
public class PSClientError : ISerializable

備註

若要取得所有發生之錯誤的如果呼叫 PSI 方法時,收到例外狀況的清單, SoapException將物件傳遞至Microsoft.Office.Project.Server.Library.PSClientError類別建構函式。您可以再用於GetAllErrorsPSErrorInfo陣列中儲存的錯誤資訊及列舉的錯誤,如下列範例所示。

注意事項注意事項

PSErrorInfo物件可能不包含所有所需的資訊。例如,如果您使用Resource.CheckOutResources其中一些資源都已取出, PSErrorInfo會顯示每一個資源都不能已取出,但不包含的資源名稱或 GUID 失敗的原因。若要取得的詳細資訊,請參閱 < CheckOutResources方法。

範例

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Services.Protocols;
using System.Windows.Forms;
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
try
{
    /* call a PSI method */
}
catch (SoapException ex)
{
    string errAttributeName;
    string errAttribute;
    string errMess = "".PadRight(30, '=') + "\r\n" + "Error: " + "\r\n";

    PSLibrary.PSClientError error = new PSLibrary.PSClientError(ex);
    PSLibrary.PSErrorInfo[] errors = error.GetAllErrors();
    PSLibrary.PSErrorInfo thisError;

    for (int i = 0; i < errors.Length; i++)
    {
        thisError = errors[i];
        errMess += "\n" + ex.Message.ToString() + "\r\n";
        errMess += "".PadRight(30, '=') + "\r\nPSCLientError Output:\r\n \r\n";
        errMess += thisError.ErrId.ToString() + "\n";

        for (int j = 0; j < thisError.ErrorAttributes.Length; j++)
        {
            errAttributeName = thisError.ErrorAttributeNames()[j];
            errAttribute = thisError.ErrorAttributes[j];
            errMess += "\r\n\t" + errAttributeName +
                       ": " + errAttribute;
        }
        errMess += "\r\n".PadRight(30, '=');
    }
    MessageBox.Show(errMess, "Error", MessageBoxButtons.OK,
        MessageBoxIcon.Error);
}

執行緒安全

這類型的任何公用 static (共用 於 Visual Basic 中) 成員是安全執行緒。不保證任何執行個體成員都是安全執行緒。

請參閱

參照

PSClientError 成員

Microsoft.Office.Project.Server.Library 命名空間

CheckOutResources

其他資源

How to: 登入 Project Server 以程式設計方式

Project Server Error Codes