Gemini Community Support Site

This Gemini community support site can be used to find solutions to product issues. You can log in using Open Id, Google Profile and even Facebook. Feel free to ask a question or browse FAQs and documentation. Product tour videos are also available along with how-to videos demonstrating key Gemini capabilities.




VB.Net CreateIssueComment is throwing exception

api

I'm trying to create a comment using the .Net API and I am getting a "Exception has been thrown by the target of an invocation. Project Id does not match saved data Id value: 0." error when calling the CreateIssueComment method. Here is my code:

Dim issueComment As New IssueCommentEN
            With issueComment
                .IssueID = GeminiIssue.IssueID
                .Comment = "string value"
                .Attachment = issueAttach
                .ProjectID = GeminiIssue.ProjectID
            End With
Dim CreateIssueComment = smProxyManager.IssuesService.CreateComment(GeminiIssue.IssueID, issueComment)

Am I doing something wrong?

JeremyJ
· 1
JeremyJ
Replies (5)
helpful
0
not helpful

You need to set the UserID, also check the Gemini system log for errors.


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Where do I set the UserID? I've changed my code a little, but is still throws the error. It is strange because it does actually create the comment on the ticket, but it doesn't add the attachment.

    Public smProxyManager As WebServices.ServiceManager = New WebServices.ServiceManager("http://unique.net/projects", "admninUser", "adminPW$", "apiKey", False)

    Dim issueAttach As New FileEN
            With issueAttach
                .IssueID = GeminiIssue.IssueID
                .FileName = a.Filename
                .FileData = byteData
            End With

    Dim issueComment As New IssueCommentEN
            With issueComment
                .IssueID = GeminiIssue.IssueID
                .Comment = "A new attachment was added to the Kayako Ticket on " & KayakoDate.ToString & _
                            vbNewLine & "Filename = " & a.Filename
                .Attachment = issueAttach
                .ProjectID = GeminiIssue.ProjectID
                .UserName = "admninUser"
            End With

    Dim CreateIssueComment = smProxyManager.IssuesService.CreateComment(GeminiIssue.IssueID, issueComment)

JeremyJ
· 1
JeremyJ
helpful
1
not helpful
ANSWER

Did you check the error in the Gemini system log?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Here is the error:

Project Id does not match saved data Id value: 0. at CounterSoft.Gemini.Presenter.Base.BasePresenter.HandleIdMismatchException(String message, Int32 id) at CounterSoft.Gemini.Presenter.Base.BasePresenter.HandleProjectIdMismatchException(Int32 projectId) at CounterSoft.Gemini.Presenter.IssuePresenter.CreateCommentAttachment(IssueEN issue, IssueCommentEN comment, FileEN attach) at CounterSoft.Gemini.Presenter.IssuePresenter.CreateIssueComment(IssueEN issue, IssueCommentEN comment) at CounterSoft.Gemini.Web.Api.IssuesRestHandler.CommentCreate(RequestDetails rd)

Basically, I wasn't setting the ProjectId property of the FileEN. This works now:

Public smProxyManager As WebServices.ServiceManager = New WebServices.ServiceManager("http://unique.net/projects", "admninUser", "adminPW$", "apiKey", False)

Dim issueAttach As New FileEN
        With issueAttach
            .IssueID = GeminiIssue.IssueID
            .FileName = a.Filename
            .FileData = byteData
            .ProjectId = GeminiIssue.ProjectID
        End With

Dim issueComment As New IssueCommentEN
        With issueComment
            .IssueID = GeminiIssue.IssueID
            .Comment = "A new attachment was added to the Kayako Ticket on " & KayakoDate.ToString & _
                        vbNewLine & "Filename = " & a.Filename
            .Attachment = issueAttach
            .ProjectID = GeminiIssue.ProjectID
            .UserName = "admninUser"
        End With

Dim CreateIssueComment = smProxyManager.IssuesService.CreateComment(GeminiIssue.IssueID, issueComment)

JeremyJ
· 1
JeremyJ
helpful
0
not helpful

Thank you!


JeremyJ
· 1
JeremyJ