AttachFileLink Method

Applies to TestComplete 14.50, last modified on April 22, 2021

Description

Use this method to attach a file link to the item that is stored in an issue-tracking system and to that the IssueTrackingItem object provides access. The file contents will not be copied into the issue-tracking database, only the file name and path will be stored.

Declaration

IssueTrackingItemObj.AttachFileLink(FileName)

IssueTrackingItemObj An expression, variable or parameter that specifies a reference to an IssueTrackingItem object
FileName [in]    Required    String    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

FileName

Specifies the file name to be attached to the item.

Result Value

None.

Remarks

When attaching a file link, remember that other users may have no access to this file since the file path specified by the link may be unavailable to them. To avoid this problem, you can use computer names in file paths (e.g. \\jsmith\logs\log.txt instead of c:\logs\log.txt) and copy the file into a shared folder before attaching a link.

Example

The code below creates a bug report in an issue-tracking system and then attaches a link to the log.txt file to it.

JavaScript, JScript

function AttachLink()
{
  // Creates a new issue
  var Item = IssueTracking.CreateWorkItem("New Item", "Short description of the item");
  // Specifies the path to the file
  var sPath = "\\\\jsmith\\logs\\log.txt";
  // Attaches the link to the file to the issue
  Item.AttachFileLink(sPath);
  // ...
}

Python

def AttachLink():
  # Creates a new issue
  Item = IssueTracking.CreateWorkItem("New Item", "Short description of the item")
  # Specifies the path to the file
  sPath = "\\\\jsmith\\logs\\log.txt"
  # Attaches the link to the file to the issue
  Item.AttachFileLink(sPath)
  # ...

VBScript

Sub AttachLink()
  ' Creates a new issue
  Set Item = IssueTracking.CreateWorkItem("New Item", "Short description of the item")
  ' Specifies the path to the file
  sPath = "\\jsmith\logs\log.txt"
  ' Attaches the link to the file to the issue
  Item.AttachFileLink(sPath)
  ' ...
End Sub

DelphiScript

function AttachLink;
var Item, sPath;
begin

  // Creates a new issue
  Item := IssueTracking.CreateWorkItem('New Item', 'Short description of the item');
  // Specifies the path to the file
  sPath := '\\jsmith\logs\log.txt';
  // Attaches the link to the file to the issue
  Item.AttachFileLink(sPath);
  // ...

end;

C++Script, C#Script

function AttachLink()
{
  // Creates a new issue
  var Item = IssueTracking["CreateWorkItem"]("New Item", "Short description of the item");
  // Specifies the path to the file
  var sPath = "\\\\jsmith\\logs\\log.txt";
  // Attaches the link to the file to the issue
  Item["AttachFileLink"](sPath);
  // ...
}

See Also

IssueTrackingItem.AttachFile
Issue-Tracking Template
Using Issue-Tracking Templates

Highlight search results