プロジェクトでのアウトラインコードの操作

Microsoft Project のアウトラインコードは、代替のプロジェクト構造を定義できるカスタムタグで、 WBS codes または アウトライン番号。これらは、組織または企業基準に従ってタスクやリソースを分類する必要がある場合に特に役立ちます。 Aspose.Tasks for .NET、これを使用するとアウトラインコードおよびそのプロパティ(例えば AliasAllLevelsRequiredEnterpriseEnterpriseOutlineCodeAliasFieldIdFieldNamePhoneticAliasGuidMasks、および Values

アウトラインコードの読み取り

その Project クラスは OutlineCodes コレクションを公開しており、 OutlineCodeDefinition オブジェクトが含まれています。
これらの定義は、各アウトラインコードの詳細情報を提供します。

次の例は、プロジェクトからアウトラインコード情報を読み取る方法を示します。

 1Project project = new Project("New Project.mpp");
 2
 3foreach (OutlineCodeDefinition ocd in project.OutlineCodes)
 4{
 5    Console.WriteLine("Alias = " + ocd.Alias);
 6    if (ocd.AllLevelsRequired)
 7        Console.WriteLine("It contains property: must have all levels");
 8    else
 9        Console.WriteLine("It does not contain property: must have all levels");
10    if (ocd.Enterprise)
11        Console.WriteLine("It is an enterprise custom outline code.");
12    else
13        Console.WriteLine("It is not an enterprise custom outline code.");
14
15    Console.WriteLine("Reference to another custom field for which this outline code definition is an alias is = " + ocd.EnterpriseOutlineCodeAlias);
16    Console.WriteLine("Field Id = " + ocd.FieldId);
17    Console.WriteLine("Field Name = " + ocd.FieldName);
18    Console.WriteLine("Phonetic Alias = " + ocd.PhoneticAlias);
19    Console.WriteLine("Guid = " + ocd.Guid);
20
21    // Display outline code masks
22    foreach (OutlineMask outlineMask in ocd.Masks)
23    {
24        Console.WriteLine("Level of a mask = " + outlineMask.Level);
25        Console.WriteLine("Mask = " + outlineMask.ToString());
26    }
27
28    // Display out line code values
29    foreach (OutlineValue outlineMask1 in ocd.Values)
30    {
31        Console.WriteLine("Description of outline value = " + outlineMask1.Description);
32        Console.WriteLine("Value Id = " + outlineMask1.ValueId);
33        Console.WriteLine("Value = " + outlineMask1.Value);
34        Console.WriteLine("Type = " + outlineMask1.Type);
35    }
36}

アウトラインコード ID の一意性の確認

アウトラインコードを操作する際、 Aspose.Tasks for .NET は自動的にアウトラインコードの ID の一意性をチェックします。重複する ID が見つかった場合は、データの整合性を保つために一意の値に置き換えられます。

 1Project project = new Project("New Project.mpp");
 2
 3OutlineCodeDefinition textOutline = new OutlineCodeDefinition();
 4textOutline.FieldId = ExtendedAttributeTask.OutlineCode7.ToString("D");
 5textOutline.Alias = "My Outline Code";
 6
 7project.OutlineCodes.Add(textOutline);
 8
 9OutlineMask mask = new OutlineMask();
10mask.Type = MaskType.Characters;
11textOutline.Masks.Add(mask);
12
13OutlineValue textValue = new OutlineValue();
14textValue.Value = "Text value 1";
15textValue.ValueId = 1;
16textValue.Type = OutlineValueType.Text;
17textValue.Description = "Text value descr 1";
18textOutline.Values.Add(textValue);
19
20project.Save("MultipleOutlineValues.mpp", SaveFileFormat.MPP);

アウトラインコードは、 ユーザー定義の分類と構造 を Microsoft Project のデータに追加する強力な手段です。
Aspose.Tasks for .NET を使用することで、これらのコードにプログラムでアクセスして管理でき、一貫性を確保し、重複識別子などのエラーを排除できます。
これにより、企業全体の基準を適用しやすくなり、プロジェクトの報告および分析が改善されます。

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.