I get a Runtime error:
"-2147219913 (80040637) Automation error
"you do not have the required permissions to execute this action"
while trying to upload a file to Test case in QC using VBA.
Set QCConnection = CreateObject("TDApiOle80.TDConnection")
QCConnection.InitConnectionEx QCurl
QCConnection.Login qcID, qcPWD
QCConnection.Connect qcDomain, qcProject
Dim runName, sCount, TestSetParent, TestSetCount, ActualMessage, attachFactory
nPath = "Test Lab Path"
Set TSetFact = QCConnection.TestSetFactory
Set tsTreeMgr = QCConnection.TestSetTreeManager
Set tsFolder = tsTreeMgr.NodeByPath(nPath)
Set tslist = tsFolder.FindTestSets("Test Set Name")
i = 1
j = 1
Set theTestSet = tslist.Item(i)
For Each testsetfound In tslist
Set tsFolder = testsetfound.TestSetFolder
Set TSTestFactory = testsetfound.TSTestFactory
Set tsTestList = TSTestFactory.NewList("")
k = 1
For Each tstItem In tsTestList
If Not IsEmpty(tstItem) Then
runName = tstItem.RunFactory.UniqueRunName
Set RunF = tstItem.RunFactory
Set theRun = RunF.AddItem(runName)
theRun.Name = runName
theRun.Status = "Passed"
theRun.CopyDesignSteps
theRun.Post
End If
Set runStepF = theRun.StepFactory
Set aTestStepArray = runStepF.NewList("")
step_cnt = aTestStepArray.Count
For j = 1 To step_cnt ' Loop through steps and update in qc
Set runStep = aTestStepArray.Item(j)
step_QC = runStep.Name
runStep.Field("ST_ACTUAL") = runStep.Field("ST_EXPECTED")
runStep.Status = "Passed"
runStep.Post
k = k + 1
Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set Inputfolder = fso.GetFolder("FilePath")
Set Infiles = Inputfolder.Files
For Each InFile In Infiles
Set attachFactory = theRun.Attachments
Set attachment = attachFactory.AddItem(Null)
attachment.Filename = "Filename"
attachment.Type = 1
attachment.Post
theRun.Refresh
theRun.Post
Set attachFactory = Nothing
Next
Next
Next
Error happens in the line
attachment.Post
What might be the required permission?