TaskItem.FileName Property

Definition

Sets or gets a string representing the file name that was passed to the Task List window when the task item was created.

public:
 property System::String ^ FileName { System::String ^ get(); void set(System::String ^ value); };
public:
 property Platform::String ^ FileName { Platform::String ^ get(); void set(Platform::String ^ value); };
[System.Runtime.InteropServices.DispId(7)]
public string FileName { [System.Runtime.InteropServices.DispId(7)] get; [System.Runtime.InteropServices.DispId(7)] set; }
[<System.Runtime.InteropServices.DispId(7)>]
[<get: System.Runtime.InteropServices.DispId(7)>]
[<set: System.Runtime.InteropServices.DispId(7)>]
member this.FileName : string with get, set
Public Property FileName As String

Property Value

A string representing the file name that was passed to the Task List window when the task item was created.

Attributes

Examples

[Visual Basic]

Sub FilenameExample()  
   ' Before running, add a task to the Task List.  
   Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindTaskList)  
   Dim TL As TaskList = win.Object  
   Dim TLItem As TaskItem = TL.TaskItems.Item(1)  
   Dim msg As String  

   ' List properties of the Task Item.  
   msg = "TaskItem Category property value: " & TLItem.Category & vbCr  
   msg = msg & "TaskItem SubCategory property value: " & TLItem.SubCategory & vbCr  
   msg = msg & "TaskItem Checked property value: " & TLItem.Checked & vbCr  
   msg = msg & "TaskItem Displayed property value: " & TLItem.Displayed & vbCr  
   ' The following line will fail with an error unless a file is   
   ' associated with the Task Item.  
   msg = msg & "TaskItem Filename property value: " & TLItem.FileName & vbCr  
   msg = msg & "TaskItem IsSettable property value: " & TLItem.IsSettable(vsTaskListColumn.vsTaskListColumnCheck) & vbCr  
   msg = msg & "TaskItem Priority property value: " & TLItem.Priority & vbCr  
   MsgBox(msg)  
End Sub  

Remarks

The empty string is a special token that indicates there is no file name associated with the task item. The FileName property returns the error, Unspecified Error, if there is no value for it (that is, no file name).

Applies to