vb.net - Sending IBM Notes Mail 9.0.1 -


lotus notes updated , became ibm notes 9.0.1 causing code i've written send email attachment fail. here's code:

public sub sendnotesmail(byval attachment string, byval torecipients list(of string), byval ccrecipients list(of string), byval saveit boolean)     'set objects required automation lotus notes     dim maildb object 'the mail database     dim username string 'the current users notes name     dim maildbname string 'the current users notes mail database name     dim maildoc object 'the mail document     dim attachme object 'the attachment richtextfile object     dim session object 'the notes session     dim embedobj object 'the embedded object (attachment)     'start session notes      plswaitfrm.show()      try         session = createobject("notes.notessession")         'get sessions username , calculate mail file name         'you may or may not need maildbname systems         'can pass empty string         username = session.username         maildbname = microsoft.visualbasic.left(username, 1) & microsoft.visualbasic.right(username, (len(username) - instr(1, username, " "))) & ".nsf"         'open mail database in notes         maildb = session.getdatabase("", maildbname)         if maildb.isopen = true             'already open mail         else             maildb.openmail()         end if         'set new mail document         maildoc = maildb.createdocument         maildoc.form = "memo"          dim recipients(torecipients.count - 1) string         integer = 0 torecipients.count - 1 step 1             recipients(i) = torecipients(i)         next          dim copies(ccrecipients.count - 1) string         integer = 0 ccrecipients.count - 1 step 1             copies(i) = ccrecipients(i)         next         'dim recipient string = string.join(", ", torecipients)         'recipient = recipient & ","         'dim copies string = string.join(", ", ccrecipients)         'copies = copies & ","         'maildoc.sendto = recipient         maildoc.copyto = copies         maildoc.subject = txtbxsubject.text         maildoc.body = txtbxbody.text         maildoc.savemessageonsend = saveit          'set embedded object , attachment , attach         if attachment <> ""             attachme = maildoc.createrichtextitem("attachment")             embedobj = attachme.embedobject(1454, "", attachment, "attachment")         end if         'send document         maildoc.posteddate = now() 'gets mail appear in sent items folder         maildoc.send(0, recipients)          dim attachmentname string = path.getfilename(attachment)         dim recipientnames new list(of string)         dim copynames new list(of string)         each contact in contactlistlocal.contacts             if contact.emailto = true recipientnames.add(contact.first & " " & contact.last)             if contact.emailcc = true copynames.add(contact.first & " " & contact.last)         next         msgbox("email message sent!" & vbcr & vbcr & "to: " & string.join(", ", recipientnames) & vbcr & vbcr & "cc: " & string.join(", ", copynames) & vbcr & vbcr & "attachment: " & attachmentname, msgboxstyle.okonly, "aztech satellite share app")     catch ex exception         errorhandler.helpers.logmessage(ex.message)         msgbox("an error occurred sending email. please contact aztech help.", msgboxstyle.okonly, "aztech satellite share app")             'clean         maildb = nothing         maildoc = nothing         attachme = nothing         session = nothing         embedobj = nothing         'raiseevent emailsent()         'plswaitfrm.close()         plswaitfrm.hide()     end try  end sub 

the line causing error: 6/12/2015 20:30:39 : server threw exception. (exception hresult: 0x80010105 (rpc_e_serverfault)) is:

maildoc.createrichtextitem("attachment")

without suggestions intellisense, , knowing next nothing inner workings of notes, i'm in dark code. have clue needs change?

edit suggested, removed code creating second attachment - maildoc.createrichtextitem("attachment"). email send, code still throws above error @ maildoc.send(0, recipients).

edit #2 emails send, occassionally messages sent twice, , @ other times notes crashes.

is there no 1 else has issue or can make recommendation?

you have 2 lines call maildoc.createrichtextitem. both of them attempt create item named "attachment". first or second 1 throws error? guess it's second one, trying create item exists. that's not normal practice, , can't think of reason why code way. likely, whatever version of notes on handled coding that, ignoring attempt add duplicate item, newer version of notes api detects error.

note it's not normal create separate notesrichtextitem named "attachment" email attachment. works, won't way expect to. normal way attach notesrichtextitem named "body". code working plain text item named "body" instead, , whomever coded didn't know rich text , same item store attachment.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -