リソースとカレンダーの操作

リソースクラスは、リソースのカレンダーを設定または取得するために使用されるカレンダープロパティを公開します。このプロパティは、Aspose.Tasks.calendarオブジェクトを受け入れて返します。

リソースカレンダーの操作

Microsoftプロジェクトのリソースのカレンダーを定義するには:

  1. リソースシートで、目的のリソースをダブルクリックします。
  2. 作業時間の変更ボタンをクリックします。

Aspose.Tasks を使用してリソースカレンダーを設定

次のコードでは、標準カレンダーとリソースを作成し、カレンダーをリソースに割り当てます。

1Project project = new Project();
2Resource res = project.Resources.Add("Resource1");
3
4// Add standard calendar and assign to resource
5Calendar cal = project.Calendars.Add("Resource1");
6res.Set(Rsc.Calendar, cal);

**Getting Resource Calendar using Aspose.Tasks **

The code below shows how to get resource calendars by traversing a project’s resources.

 1Project project = new Project("New Project.mpp");
 2
 3// Display base calendar name for all resources
 4foreach (Resource res in project.Resources)
 5{
 6    if (res.Get(Rsc.Name) != null)
 7    {
 8        Console.WriteLine(res.Get(Rsc.Calendar).BaseCalendar.Name);
 9    }
10}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.