I am sharing this info as I had to do quite a research before i found the solution.
Problem: Copy a test set from one folder to another in Quality Center test lab using code.
First things first: This cannot be coded in vbscript or QTP as it uses the ISupportCopyPaste interface and the CopyToClipboard method which is part of this interface. Therefore you cannot declare a statement like Dim iscp As ISupportCopyPaste
A simpler way would be to use vba and do the following:
1. Add the following code in excel vba editor.
2. Add the "OTA COM Type Library" as a reference under tools -> references from excel.
3. Run and enjoy the magic :-)
Public Function CopyPasteTestSetFolder(sourceFolderPath, destFolderPath)
strServer = "http://xyz/qcbin"
strDomain = ""
strProject = ""
strUser = ""
strPassword = ""
Set objTDConnection = CreateObject("tdapiole80.TDCONNECTION")
objTDConnection.InitConnection strServer, strDomain
objTDConnection.ConnectProject strProject, strUser, strPassword
Set objTreeManager = objTDConnection.TestSetTreeManager
Set sourceFolder = objTreeManager.NodeByPath(sourceFolderPath)
Set destFolder = objTreeManager.NodeByPath(destFolderPath)
Dim iscp As ISupportCopyPaste
Set iscp = sourceFolder
clipboard = iscp.CopyToClipBoard(sourceFolder.NodeID, 0, sourceFolderPath)
Set iscp = destFolder
iscp.PasteFromClipBoard clipboard, destFolder.NodeID, 0, -1
Set treeMng = Nothing
Set sourceFolder = Nothing
Set destFolder = Nothing
Set iscp = Nothing