Quick test professional

QTP Tips QTP codes QTP Faqs and more

Remove Attachment from QC Through QTP

‘The following function will Remove the specified attachment  from the current test of QC when  the file name provided
Function RemoveQCAttachements(NameOfTheFile)
var_count= QCUtil.CurrentTest.Attachments.NewList(“”).count
For i= 1 to var_count

 If   QCUtil.CurrentTest.Attachments.NewList(“”).Item(2).Name =NameOfTheFile Then
         AttachmentID = QCUtil.CurrentTest.Attachments.NewList(“”).Item(1).ID
     Reporter.ReportEvent micFail,”Please provide the valid filename with extention”,”Please provide the valid filename with extention”
 End If

End Function

NameOfTheFile=”abc.vbs” ‘Provide the file name with extension
call RemoveQCAttachements(NameOfTheFile)

Author:Mohan Kakarla


September 24, 2008 - Posted by | Automating QC, QC-OTA | , ,


  1. Hi Mohan,
    I want to copy the scripts in QC to my local folder. There are 400 scripts, i want to do from qtp , can you throw some light on how to do this.We are no more using QC and want to move all the scripts to local folder.
    Appreciate your response.

    Comment by Srini | February 27, 2010 | Reply

  2. Hello Mohan,

    I have an attachement in the Test folder, how can I script to remove the attachment from the test folder.


    Comment by Puneet | March 18, 2010 | Reply

  3. I wan to delete attachment from test folder not from CURRENT test , can any body help on same.


    Comment by deepika | July 9, 2010 | Reply

  4. Hello Mohan,

    Currently, we have a lot of attachments in TestLab.
    How can we remove the attachment from the Test Lab by QC funtionality?

    Thank you.

    Comment by Wichitra | July 16, 2010 | Reply

  5. Great job on the blog. very very helpful.

    Comment by Maha Kumar (@mahakumar) | September 17, 2011 | Reply

  6. How to upload a file into specific folder in Resources Tab?

    Comment by Baba | October 24, 2011 | Reply

  7. Hi Mohan,
    I want the code for this”Test data is in the excel sheet,how will we get that in reverse order

    Comment by suresh | January 2, 2012 | Reply

  8. Hello Mohan,
    Can you help me in developing a code which will copy a folder under Resouces tab to another folder in resources tab?


    Comment by Kranthi Kumar | March 14, 2012 | Reply

  9. […] Remove Attachment from QC Through QTP […]

    Pingback by tallada | September 18, 2012 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: