Jump to content

COM Object .AddItem(Nothing)


Recommended Posts

I'm trying to create an interface to allow some user to create a new Defect in Quality Center 11.

I have the script now to the point where it will log in to the specific project in Quality Center but when I try to create a new defect I get a "The requested action with this object has failed"

All of the scripts i found online say to use BugFactory.AddItem(Nothing)

I have tried "Nothing", "", Chr(0), also just omitting the () all with the same error.

Anybody have any ideas on this?

$ObjName = RegRead("HKEY_CLASSES_ROOT\TDApiOle80.TDConnection\CurVer", "")
if $ObjName = "" Then
MsgBox(270384,"QC Addin not found","Please visit this page to download the Quality Center Add-In" & @CRLF & @CRLF & "http://Bla-Bla-Bla.com:8080/qcbin/TDConnectivity_index.html")
Exit
EndIf
$HostName = "http://bla-bla-bla:8080/qcbin/"
$Domain = "Proj_Domain"
$Project = "Test"
$UserID = "test-ID"
$PassWd = "Password1"

$objOTAapi = ObjCreate($ObjName)
$objOTAapi.InitConnectionEx($HostName)
$objOTAapi.Login($UserID,$PassWd)
$LoginVal = $objOTAapi.LoggedIn
If $LoginVal <> True Then
MsgBox(0, "", "Login Failed")
Exit
EndIf
$objOTAapi.Connect($Domain, $Project)
$ProjectVal = $objOTAapi.Connected
if $ProjectVal <> True Then
MsgBox(0, "", "Failed to connect to " & $Domain & "\" & $Project)
$objOTAapi.Logout
EndIf

;~ Get bug factory
$bfact = $objOTAapi.BugFactory

;These 2 lines are just to get the count of fields to ensure properly connected to bugfactory
;~ $FieldList = $bfact.Fields
;~ MsgBox(0, "", $FieldList.Count)

;~ Add defects
$Summary = "This is a test from the External script"
$Status = "New"
$AssignTo = "admin"
$mybug = $bfact.AddItem(Chr(0)) ;<==This line is being a PITA!
$mybug.Summary = $Summary
$mybug.Status = $Status
$mybug.AssignedTo = $AssignTo
$mybug.Post

$objOTAapi.DisconnectProject()
$objOTAapi.ReleaseConnection()

It's been over a year since I have done an AutoIT script so sorry if I messed up something simple.

Thanks,

Mike

ps. the new forum setup looks cool

Link to comment
Share on other sites

Zorphnog,

Thanks for the link. I tried using that and i'm still getting an error even with $Nothing. I found the better error handler _IEErrorHandlerRegister so I have more details.

No matter what I try I keep getting the same error message for that .AddItem line.

--> COM Error Encountered in QC Add a Defect.au3

----> $ErrorScriptline = 48

----> $ErrorNumberHex = 80020009

----> $ErrorNumber = -2147352567

----> $ErrorWinDescription =

----> $ErrorDescription = Parameter Type is Invalid

----> $ErrorSource =

----> $ErrorHelpFile =

----> $ErrorHelpContext = 5832762

----> $ErrorLastDllError = 0+>09:12:03 AutoIT3.exe ended.rc:0

Link to comment
Share on other sites

Use the latest beta (3.3.9.4) and try this:

$mybug = $bfact.AddItem(NULL)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...