Mantis mc_issue_relationship_add

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
$ticketdetails = $mantis.mc_issue_get($Username,$Password,$ticket)

But when I try and add a relationship:

    $mantis = New-WebServiceProxy -Uri
    $Relationship = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.issuerelationshipadd"
    $ = $Ticket 
    $ = 3
    $Relationship.Target_id = $TargetID

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.

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.


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:

[quote quote=115086][/quote]

Yes, you’re right, hence the “New-Object

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

Solution is:

    $mantis = New-WebServiceProxy -Uri
    $Relationship = New-Object ($mantis.GetType().Namespace + ".RelationshipData")
    $ = $Ticket 
    $Relationship.Target_id = $TargetID
    $type = New-Object ($mantis.GetType().Namespace + ".ObjectRef")
    $ = 2
    $Relationship.type = $type