Bagikan melalui


WorkItem Class

Represents a work item on Team Foundation Server.

Inheritance Hierarchy

System.Object
  Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem

Namespace:  Microsoft.TeamFoundation.WorkItemTracking.Client
Assembly:  Microsoft.TeamFoundation.WorkItemTracking.Client (in Microsoft.TeamFoundation.WorkItemTracking.Client.dll)

Syntax

'Declaration
Public NotInheritable Class WorkItem
public sealed class WorkItem
public ref class WorkItem sealed
[<Sealed>]
type WorkItem =  class end
public final class WorkItem

The WorkItem type exposes the following members.

Constructors

  Name Description
Public method WorkItem Initializes a new instance of the WorkItem class of the specified WorkItemType.

Top

Properties

  Name Description
Public property AreaId Gets or sets the integer value of the AreaId field for this work item.
Public property AreaPath Gets or sets the string value of the AreaPath field for this work item.
Public property AttachedFileCount Gets the number of attached files for this work item.
Public property Attachments Gets the AttachmentCollection object that represents the attachments that belong to this work item.
Public property AuthorizedDate
Public property ChangedBy Gets the string value of the ChangedBy field for this work item.
Public property ChangedDate Gets the DateTime object that represents the date and time that this work item was last changed.
Public property CreatedBy Gets the string value of the CreatedBy field for this work item.
Public property CreatedDate Gets the DateTime object that represents the date and time that this work item was created.
Public property Description Gets or sets a string that describes this work item.
Public property DisplayForm Gets the display form that is associated with this work item.
Public property ExternalLinkCount Gets the number of external links in this work item.
Public property Fields Gets the FieldCollection object that contains the Fields of this work item.
Public property History Gets or sets the string value of the History field for this work item.
Public property HyperLinkCount Gets the number of hyperlinks in this work item.
Public property Id Gets the ID of this work item.
Public property IsDirty Gets a flag that describes whether this work item has been changed since its last save.
Public property IsNew Gets a flag that describes whether this work item is new.
Public property IsOpen Gets a flag that describes whether this work item is currently open for edit.
Public property IsPartialOpen Gets a flag that describes whether the work item is partially opened.
Public property IsReadOnly Gets a flag that describes whether the work item is read-only.
Public property IsReadOnlyOpen Gets a flag that describes whether the work item is open as read-only.
Public property Item[String] Gets or sets the value of a field in this work item that is specified by the field name.
Public property Item[CoreField] Gets or sets the value of a field in this work item that is specified by the field ID.
Public property IterationId Gets or sets the integer value of the IterationId field of this work item.
Public property IterationPath Gets or sets the string value of the IterationPath field of this work item.
Public property Links Gets the collection of the links in this work item.
Public property NodeName Gets or sets the string value of the NodeName field of this work item.
Public property Project Gets the current project that is associated with this work item.
Public property Reason Gets or sets the string value of the Reason field for this work item.
Public property RelatedLinkCount Gets the number of related links of this work item.
Public property Rev Gets the integer that represents the revision number of this work item.
Public property RevisedDate Gets a DateTime object that represents the revision date and time of this work item.
Public property Revision Gets the integer that represents the revision number of this work item.
Public property Revisions Gets a RevisionCollection object that represents a collection of valid revision numbers for this work item.
Public property State Gets or sets a string that describes the state of this work item.
Public property Store Gets the WorkItemStore to which this work item belongs.
Public property Tags
Public property TemporaryId Gets the temporary ID of this work item.
Public property Title Gets or sets a string that describes the title of this work item.
Public property Type Gets a WorkItemType object that represents the type of this work item.
Public property Uri Gets the uniform resource identifier (Uri) of this work item.
Public property Watermark
Public property WorkItemLinkHistory Gets a WorkItemLinkCollection object that represents a collection of the WorkItemLinks that link to this work item now or linked to it in the past.
Public property WorkItemLinks Gets a WorkItemLinkCollection object that represents a collection of the WorkItemLinks that currently link to this work item.

Top

Methods

  Name Description
Public method Close Closes this WorkItem instance and frees memory that is associated with it.
Public method Copy() Creates a copy of this WorkItem instance.
Public method Copy(WorkItemType) Creates a copy of this WorkItem instance that is of the specified WorkItemType.
Public method Copy(WorkItemType, WorkItemCopyFlags) Creates a copy of this WorkItem instance that is of the specified WorkItemType.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetNextState Gets the next state of this work item based on the action of a user.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsValid Validates the fields of this work item.
Public method Open Opens this work item for modification.
Public method PartialOpen Opens this work item for modification when transmitting minimal amounts of data over the network.
Public method Reset Reverts all changes that were made since the last save.
Public method Save() Saves any pending changes on this work item.
Public method Save(SaveFlags) Saves any pending changes on this work item.
Public method SetDirty Temporarily overrides the dirty state of a work item. Any modification to the work item will cause this to be reset to the correct value, depending on the work item's modification state.
Public method SyncToLatest Synchronizes the work item to the latest revision.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method Validate Gets an ArrayList of fields in this work item that are not valid.

Top

Events

  Name Description
Public event FieldChanged Occurs when a field is updated in this WorkItem instance.
Public event Saving The event gets fired every time that the work item is about to be saved.

Top

Remarks

The following methods to access the fields and field values are available:

  • WorkItem["field-name"] gets/sets the value of a field.

  • WorkItem.Fields["field-name"] gets/sets the field, not the value.

  • WorkItem.Fields["field-name"].Value gets/sets the value of the field.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.TeamFoundation.WorkItemTracking.Client Namespace