Mantis mc_issue_relationship_add

Welcome Forums General PowerShell Q&A Mantis mc_issue_relationship_add

This topic contains 3 replies, has 2 voices, and was last updated by

 
Participant
1 month, 3 weeks ago.

  • Author
    Posts
  • #114859

    Participant
    Points: 123
    Rank: Participant

    I've got Functions for managing Mantis 'tickets', updating, adding notes, adding attachments but I'm hitting a problem with adding in a relationship to other tickets.
    I can read the ticket and get relationships: $mantis = New-WebServiceProxy -Uri http://tickets.empyreanbenefits.com/api/soap/mantisconnect.php?wsdl
    $ticketdetails = $mantis.mc_issue_get($Username,$Password,$ticket)
    $ticketdetails.relationships

    But when I try and add a relationship:

    
        $mantis = New-WebServiceProxy -Uri http://tickets.empyreanbenefits.com/api/soap/mantisconnect.php?wsdl
        $Relationship = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.issuerelationshipadd"
        $Relationship.id = $Ticket 
        $Relationship.type.id = 3
        $Relationship.Target_id = $TargetID
        $mantis.mc_issue_relationship_add($Username,$Password,$ticket,$Relationship)
    

    I get this error:

    New-Object : Cannot find type [Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.issuerelationshipadd]: verify that the 
    assembly containing this type is loaded.
    
    Attachments:
  • #115086

    Participant
    Points: 321
    Helping Hand
    Rank: Contributor

    This may not be a PS native issue, but something relative mantis wsdl or other environment issue.
    Usually this sort of error has to do with not doing something like the below.

    [System.Reflection.Assembly]::LoadFrom('c:\SomeLibraryOrReference.dll')
    

    All that being said, and full disclosure, I don' t use Mantis nor do any of my customers I support / consult with / for. so see the below:

    https://www.mantisbt.org/forums/viewtopic.php?f=2&t=24461
    https://mantisbt.org/forums/viewtopic.php?f=3&t=25896
    https://www.administrator.de/forum/powershell-soap-wsdl-mantis-bug-tracker-272228.html

  • #115128

    Participant
    Points: 123
    Rank: Participant

    Yes, you're right, hence the "New-Object
    "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.issuerelationshipadd""

    btw the mantis link you put in, for 25896, that's my post asking them the same question, the 24461 and the one from administrator.de has no relevance to the issue, except that it's also Mantis.

  • #117585

    Participant
    Points: 123
    Rank: Participant

    Solution is:

        $mantis = New-WebServiceProxy -Uri http://tickets.empyreanbenefits.com/api/soap/mantisconnect.php?wsdl
        $Relationship = New-Object ($mantis.GetType().Namespace + ".RelationshipData")
        $Relationship.id = $Ticket 
        $Relationship.Target_id = $TargetID
        $type = New-Object ($mantis.GetType().Namespace + ".ObjectRef")
        $type.id = 2
        $Relationship.type = $type
        $mantis.mc_issue_relationship_add($Username,$Password,$ticket,$Relationship)
    

You must be logged in to reply to this topic.