Share via


WorkItem.Copy Method

Creates a copy of the current WorkItem.

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

Syntax

'Declaration
Public Function Copy As WorkItem
'Usage
Dim instance As WorkItem 
Dim returnValue As WorkItem 

returnValue = instance.Copy()
public WorkItem Copy()
public:
WorkItem^ Copy()
public function Copy() : WorkItem

Return Value

Type: Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem

Remarks

Makes a copy of the current WorkItem with the latest values even if the values are not committed.

The copy is opened as a new WorkItem and will undergo initial rules and transitions for this.type.

Except for fields State and Reason, the latest field values of this are copied over even if those field values have not yet been committed.

State and Reason are set to default values for a new work item.

The Changed date/by, Opened date/by dates are not copied.

History is copied as follows:

  • A comment specifies that the returned WorkItem is a copy of this.

  • Each revision of History is aggregated into a single entry.

  • Each revision from the original is tagged in the aggregated entry.

  • For the first revision on this, the tag is "Created by <user> on <date>."

  • For subsequent edits, the tag is "Edited by <user> on <date>."

  • For state transitions, the tag is "Transitioned from <Original state> to <New state> by <user> on <date>."

  • If the "changed by" person who made the change was not the authenticated user, the <user> part of the tag is expanded to "<changedbyuser>(<authenticateduser>)."

  • All formatted strings use the localized strings that are based on the client doing the copy.

  • The returned WorkItem is on its first revision and will not copy the revision history of this.

A related link is created between the returned WorkItem and this with an appropriate comment.

Links and attachments from this are not copied.

The latest field values of this are copied over even if those field values have not yet been committed.

The returned WorkItem may be in an invalid state that cannot be committed.

.NET Framework Security

See Also

Reference

WorkItem Class

WorkItem Members

Copy Overload

Microsoft.TeamFoundation.WorkItemTracking.Client Namespace