[VB.NET] probleempje met overnemen string (office library)

Pagina: 1
Acties:

  • NoFate
  • Registratie: Januari 2003
  • Laatst online: 21:09
Hallo,

Ik heb een probleempje met een scriptje dat ik aan het maken ben

Het is een scriptje waarmee ik attributen kan meegeven , en die attributen worden dan in outlook ingevuld

een vb ter verduidelijking :

mailing.exe fabio@lipa.be subject: test body: test attach: c:\testfile.htm

Afbeeldingslocatie: http://users.skynet.be/bk381139/foutje.jpg

Maar het ptobleem ligt bij de attachement , deze wordt niet goed ingevuld in outlook
(zie het kleine witte vierkantje op het icoontje)
Daardoor wordt de attachement niet meegestuurd
Ik heb al uren staan zoeken maar kan het probleem niet vinden
Hebben jullie enig idee?

Bedankt


dit is de code :


Imports Outlook
Imports System.IO

Module Module1

Sub Main(ByVal args() As String)
Dim appOutlook As New Outlook.Application
Dim item As Outlook.MailItem = appOutlook.CreateItem(Outlook.OlItemType.olMailItem)
Dim argcounter As Integer = 2
Dim subject As String
Dim body As String
item.To = args(0)
If args(1) <> "subject:" Then
MsgBox("no subject: node defined !")
Exit Sub
Else
While args(argcounter) <> "body:"
subject = subject + " " + args(argcounter)
argcounter += 1
End While
End If
If args(argcounter) <> "body:" Then
MsgBox("no attachment: node defined !")
Exit Sub
Else
While args(argcounter) <> "attach:"
body &= " " + args(argcounter)
argcounter += 1
End While
End If
If args(argcounter) <> "attach:" Then
MsgBox("no attachment: node defined !")
Exit Sub
Else
Dim attachstore As String
If argcounter + 1 = args.Length Then
attachstore = args(argcounter + 1)
Else

For i As Integer = argcounter + 1 To args.Length - 1
attachstore &= " " + args(i)
Next
End If
attachstore = attachstore.Trim(" ")
If IO.File.Exists(attachstore) Then
item.Attachments.Add(attachstore, Nothing, body.Length + 1, attachstore.Substring(attachstore.IndexOf("\")))
Else
MsgBox("file not found")
End If
End If
item.Subject = subject
item.BodyFormat = OlBodyFormat.olFormatHTML
item.Body = body.Replace("body:", "")
item.Display()
End Sub
End Module

[ Voor 7% gewijzigd door NoFate op 13-12-2004 16:10 ]