LookupTable.CreateLookupTables 方法
建立自訂欄位的查閱表格和對應的代碼遮罩。
命名空間: WebSvcLookupTable
組件: ProjectServerServices (在 ProjectServerServices.dll 中)
語法
'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/LookupTable/CreateLookupTables", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/LookupTable/", _
ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/LookupTable/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub CreateLookupTables ( _
ltds As LookupTableDataSet, _
validateOnly As Boolean, _
autoCheckIn As Boolean _
)
'用途
Dim instance As LookupTable
Dim ltds As LookupTableDataSet
Dim validateOnly As Boolean
Dim autoCheckIn As Boolean
instance.CreateLookupTables(ltds, validateOnly, _
autoCheckIn)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/LookupTable/CreateLookupTables", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/LookupTable/",
ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/LookupTable/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void CreateLookupTables(
LookupTableDataSet ltds,
bool validateOnly,
bool autoCheckIn
)
參數
ltds
類型:WebSvcLookupTable.LookupTableDataSetLookupTableDataSet datatable 中包含資料。
validateOnly
類型:System.Boolean僅限驗證,請勿建立。
autoCheckIn
類型:System.Boolean如果true,建立之後存回。
備註
If you create a non-text lookup table such as type Cost, Date, Duration, or Number, you still need to programmatically create a code mask. Project Web App hides the code mask for non-text lookup tables in the New Lookup Table page, but creates a code mask for the call to CreateLookupTable. For an example that creates a Duration lookup table, see CreateLookupTablesMultiLang. For more examples, see Using the ProjTool Test Application.
CreateLookupTables前的事件是LookupTableEventReceiver.OnCreating與後置事件是OnCreated。
注意事項 |
---|
前與後的事件CreateLookupTables公開LookupTableMultiLangDataSet事件處理常式,而不是LookupTableDataSete參數中。 |
To use datasets in event handlers, set a reference to the Microsoft.Office.Project.Schema.dll assembly. For more information, see How to: Write and Debug a Project Server Event Handler. For more examples, see Using the ProjTool Test Application.
注意
當您使用 PSI 來建立或更新的數字的查閱表格時,請勿加上有多個兩個小數位數的值。
CreateLookupTables方法可讓您儲存含有兩個以上的小數位數。當您建立使用數字的查閱表格的自訂欄位時, Project Professional 2010會將 number 四捨五入至兩個小數位數的數字自訂欄位值,並顯示其為在下拉式清單中選取一個值的字串。當您選取一個值時, Project Professional 2010會將字串轉換回到數字。程序會顯示錯誤,因為具有兩個小數位數數值不存在。
Project Server 權限
權限 |
描述 |
---|---|
可讓使用者修改企業自訂欄位與查閱表格值的定義。通用權限。 |
範例
下列程式碼是從不同資料表中LookupTableMultiLanguageDataSet取得資料的CreateLookupTables前的事件處理常式。
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
public class LookupTableEvents : LookupTableEventReceiver
{
public override void OnCreating(PSLibrary.PSContextInfo contextInfo,
LookupTablePreEventArgs e)
{
int lutLanguage =
(int)e.LookupTableInformation.LookupTableLanguages.Rows[0]["LCID"];
Guid lutMultiUid =
(Guid)e.LookupTableInformation.LookupTables.Rows[0]["LT_UID"];
string lutMultiValue =
(string)e.LookupTableInformation.LookupTableValues.Rows[0]["LT_VALUE_TEXT"];
. . .
}