リソースの拡張属性の管理

Resource クラスで公開されている ExtendedAttribute プロパティは、リソースの拡張属性を管理するために使用できます。このプロパティはリソースの拡張属性を扱うために ExtendedAttribute オブジェクトの ArrayList を読み書きします。ExtendedAttribute オブジェクトは関連するプロパティも公開します。

Aspose.Tasks を使用した拡張リソース属性の設定

次のコード例は、リソースの拡張属性を設定する方法を示します。このスニペットでは、拡張属性を作成し、それをリソースに割り当て、既定のプロパティを拡張するカスタム値を定義する方法を示しています。

 1Project project = new Project("New Project.mpp");
 2
 3// Define extended attribute
 4ExtendedAttributeDefinition myNumber1 = project.ExtendedAttributes.GetById((int)ExtendedAttributeTask.Number1);
 5if (myNumber1 == null)
 6{
 7    myNumber1 = ExtendedAttributeDefinition.CreateResourceDefinition(ExtendedAttributeResource.Number1, "Age");
 8    project.ExtendedAttributes.Add(myNumber1);
 9}
10
11// Create extended attribute and set its value
12ExtendedAttribute number1Resource = myNumber1.CreateExtendedAttribute();
13number1Resource.NumericValue = 30.5345m;
14
15// Add a new resource and its extended attribute   
16Resource resource = project.Resources.Add("R1");
17resource.ExtendedAttributes.Add(number1Resource);
18
19project.Save("ResourceExtendedAttributes_out.mpp", SaveFileFormat.MPP);

よくある質問

Q: Microsoft Project における拡張リソース属性とは何ですか?

Q: 拡張属性に対してプログラムでカスタム値を定義できますか?

Q: ファイルを Microsoft Project で開いた場合、拡張属性は保持されますか?

結論

Aspose.Tasks for .NET を使用して拡張リソース属性を管理すると、リソースにカスタム情報を追加する柔軟性が得られます。拡張属性をプログラムで作成・割り当てすることで、プロジェクトデータを充実させ、Microsoft Project での手動編集を行うことなく高度な報告や解析をサポートできます。

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.