Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting code for creating tasks in outlook.

Status
Not open for further replies.

MrKovacic

IS-IT--Management
Nov 5, 2002
213
US
Hello all!

I was given this code to create tasks in outlook, but I am not sure how to add an attachment.. Here is the code..

Code:
Set OlApp = CreateObject("Outlook.Application")
Set nsNameSpace = OlApp.GetNamespace("MAPI")
Set olFolderCalendar = nsNameSpace.GetDefaultFolder(9) 'olFolderCalendar

Set olEvent = OlApp.CreateItem(1) 'olAppointmentItem
olEvent.Start = DateAdd("n", 1, Now())
olEvent.Subject = "Hi"
olEvent.ReminderSet = True
olEvent.ReminderMinutesBeforeStart = 1

olEvent.Save


'MsgBox ("Event created in your Outlook calendar.")

Now, here is the code I have that makes the attachment:

Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
iklogname = InputBox("Input your Remedy Ticket number (not including the zeros.)")
If iklogname = "" Then
Wscript.Quit 1
Else
DIM fso, GuyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set remedyticket = fso.CreateTextFile("RemedyTicket " & iklogname & ".ARTask", True)
remedyticket.WriteLine("[Shortcut]") 
remedyticket.WriteLine ("Name = HPD:HelpDesk") 
remedyticket.WriteLine ("Type = 0") 
remedyticket.WriteLine ("Server = our.remedy.server") 
remedyticket.WriteLine ("Join = 0") 
remedyticket.WriteLine ("Ticket = 00000000" & iklogname) 
remedyticket.Close
END IF

The attachment this script creates, I want to place into the task that is made by the first script and I have no idea.. Any help would be greatly appreciated!!

Thanks in advance!!!!!

Thank you!!!

Mike Kovacic
 
A starting point:
olEvent.Attachments.Add ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I will give that a shot.. thanks!!


Thank you!!!

Mike Kovacic
 
I formatted the code like this:
Code:
olEvent.Attachments.Add ="attached.txt"
but was not able to get it to work

Thank you!!!

Mike Kovacic
 
straight from the object browser, the prototype of this metod:
Function Add(Source, [Type], [Position], [DisplayName]) As Attachment

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I tried it an i think i am lost. :\

The code looks good, I am just failing to integrate it with the script.. I am a true n00b at this.

Thank you!!!

Mike Kovacic
 
>[tt]Function Add(Source, [Type], [Position], [DisplayName]) As Attachment [/tt]
means you should do instead this.
>olEvent.Attachments.Add ="attached.txt"
[tt]olEvent.Attachments.Add[highlight] [/highlight]"attached.txt"[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top