Resource in Windows Forms projio (ProjIO)

Resources class can be used to create resources and add them to Projects. However, creating resources do not assign them to tasks. One has to explicitly assign the resources to tasks using Assignment class (4.4).Using the Resources class, one can create, add, and modify resources to projects. It can also be used to retrieve resource information.

Properties, Methods, and Events Tables for Task

Constructors

Resource Constructor

Name Description
Resource.Resource() Initializes a new instance of the Resource class.

Properties

Resource Properties

Property Description
UID Gets or sets the unique identifier of the resource
ID Gets or sets the position identifier of the resource within the list of resources
Name Gets or sets the name of the resource
Type Gets or sets the type of resource
IsNull True if the resource is null
Initials Gets or sets the initials of the resource
Phonetics Gets or sets the phonetic spelling of the resource name. For use with Japanese only.
NTAccount Gets or sets the NT account associated with the resource
MaterialLabel Gets or sets the unit of measure for the material resource
Code Gets or sets the code or other information about the resource
Group Gets or sets the group to which the resource belongs
WorkGroup Gets or sets the type of workgroup to which the resource belongs
EmailAddress Gets or sets the email address of the resource
Hyperlink Gets or sets the title of the hyperlink associated with the resource
HyperlinkAddress Gets or sets the hyperlink associated with the resource
HyperlinkSubAddress Gets or sets the document bookmark of the hyperlink associated with the resource
MaxUnits Gets or sets the maximum number of units that the resource is available
PeakUnits Gets or sets the largest number of units assigned to the resource at any time
OverAllocated True if the resource is over allocated.
AvailableFrom Gets or sets the first date that the resource is available.
AvailableTo Gets or sets the last date the resource is available.
Start Gets or sets the scheduled start date of the resource.
Finish Gets or sets the scheduled finish date of the resource.
CanLevel True if the resource can be leveled.
AccrueAt Gets or sets how cost is accrued against the resource.
Work Gets or sets the total work assigned to the resource across all assigned tasks.
RegularWork Gets or sets the amount of non-overtime work assigned to the resource.
OvertimeWork Gets or sets the amount of overtime work assigned to the resource.
ActualWork Gets or sets the amount of actual work performed by the resource.
RemainingWork Gets or sets the amount of remaining work required to complete all assigned tasks.
ActualOvertimeWork Gets or sets the amount of actual overtime work performed by the resource.
RemainingOvertimeWork Gets or sets the amount of remaining overtime work required to complete all tasks.
PercentWorkComplete Gets or sets the percentage of work completed across all tasks.
StandardRate Gets or sets the standard rate of the resource. This value is as of the current date if a rate table exists for the resource.
StandardRateFormat Gets or sets the units used by Microsoft Project to display the standard rate.
Cost Gets or sets the total project cost for the resource across all assigned tasks.
OvertimeRate Gets or sets the overtime rate of the resource. This value is as of the current date if a rate table exists for the resource.
OvertimeRateFormat Gets or sets the units used by Microsoft Project to display the overtime rate.
OvertimeCost Gets or sets the total overtime cost for the resource including actual and remaining overtime costs.
CostPerUse Gets or sets the cost per use of the resource. This value is as of the current date if a rate table exists for the resource.
ActualCost Gets or sets the actual cost incurred by the resource across all assigned tasks.
ActualOvertimeCost Gets or sets the actual overtime cost incurred by the resource across all assigned tasks.
Remaining Cost Gets or sets the remaining projected cost of the resource to complete all assigned tasks.
RemainingOvertimeCost Gets or sets the remaining projected overtime cost of the resource to complete all assigned tasks.
WorkVariance Gets or sets the difference between the baseline work and the work as minutes x 1000.
CostVariance Gets or sets the difference between the baseline cost and the cost.
SV Gets or sets the earned value schedule variance, through the project status date.
CV Gets or sets the earned value cost variance, through the project status date.
ACWP Gets or sets the actual cost of the work performed by the resource for the project to-date.
CalendarUID Gets or sets the resource calendar. Refers to a valid UID in the Calendars collection.
Notes Gets or sets the text notes associated with the resource.
BCWS Gets or sets the budget cost of work scheduled for the resource.
BCWP Gets or sets the budgeted cost of the work performed by the resource for the project to-date.
IsGeneric True if the resource is generic.
IsInactive True if the resource is set to inactive.
IsEnterprise True if the resource is an Enterprise resource.
BookingType Gets or sets the booking type of the resource.
ActualWorkProtected Gets or sets the duration through which actual work is protected.
ActualOvertimeWorkProtected Gets or sets the duration through which actual overtime work is protected.
ActiveDirectoryGUID Gets or sets the Active Directory GUID for the resource.
CreationDate Gets or sets the date the resource was created.
ExtendedAttribute Gets or sets the value of an extended attribute.
Baseline Gets or sets the baseline values for the resources.
OutlineCode Gets or sets the value of an outline code.
IsCostResource True if the resource is a cost resource.
AssnOwner Gets or sets the name of the assignment owner.
AssnOwnerGuid Gets or sets the GUID of the assignment owner.
IsBudget True if the resource is a budget resource.
AvailabilityPeriods Gets or sets the collection of periods during which the resource is available.
Rates Gets or sets the collection of periods and the rates associated with each one.
TimePhasedData Gets or sets the time phased data.

Methods

Resource Methods

Method Description
Equals Returns a value indicating whether this instance is equal to a specified object.
GetHashCode Serves as a hash function for Resource type.
GetType Gets the type of the current instance.
ToString Returns a string that represents the current object.

Adding Resources to a Project

Resources property exposed by Project class represents the list of all the Resource objects in a project. This property can be used to add resources.

The following code snippet illustrates adding resources to a project.

  • c#
  • // Creating an instance of the Project
    Project project = new Project();
    // Creating resource
    Resource resource = new Resource();
    resource.Name = "Resource1";
    // Adding resource to project
    project.Resources.Add(resource);
  • vbnet
  • 'Creating an instance of the Project
    Dim project As Project = New Project()
    ' Creating resource
    Dim resource As Resource = New Resource()
    resource.Name = "Resource1"
    ' Adding resource to Project
    project.Resources.Add(resource)

    Writing Resources to a Project

    Resources property exposed by Project class represents the list of all the Resource objects in a project. This property can be used to update resources in a project.

    The following code shows how to write resources to a project.

  • c#
  • // Creating an instance of the Project
    
    Project project = new Project();
    
    
    
    // Creating resource
    
    Resource resource = new Resource();
    
    resource.Name = "Resource1";
    
    
    
    // Adding resource to project
    
    project.Resources.Add(resource);
    
    
    
    // Calculating Resource IDs and UIDs
    
    project.CalculateResourceIDs();
    
    
    
    // Saving the project
    
    project.Save("Project With Resources.xml");
  • vbnet
  • ' Creating an instance of the Project
    
    Dim project As Project = New Project()
    
    
    
    ' Creating resource
    
    Dim resource As Resource = New Resource()
    
    resource.Name = "Resource1"
    
    
    
    ' Adding resource to Project
    
    project.Resources.Add(resource)
    
    
    
    ' Calculating Resource IDs and UIDs
    
    project.CalculateResourceIDs()
    
    
    
    ' Saving the project
    
    project.Save(@"D:\Project With Resources.xml")