Shevilie Posted November 6, 2006 Posted November 6, 2006 (edited) Well I've started to write a way to add apointment to Outlook via com, but it doesnt seems to work Well i never played with com before, but it seemed to be a good place to start... I found this on Microsofts site Private Sub ThisApplication_Startup(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Startup Dim agendaMeeting As Outlook.AppointmentItem = CType( _ Me.CreateItem(Outlook.OlItemType.olAppointmentItem), _ Outlook.AppointmentItem) If agendaMeeting IsNot Nothing Then agendaMeeting.MeetingStatus = _ Outlook.OlMeetingStatus.olMeeting agendaMeeting.Location = "Conference Room" agendaMeeting.Subject = "Discussing the Agenda" agendaMeeting.Body = "Let's get together to discuss the " _ & "agenda." agendaMeeting.Start = New System.DateTime( _ 2005, 5, 5, 5, 0, 0) agendaMeeting.Duration = 60 Dim recipient As Outlook.Recipient = _ agendaMeeting.Recipients.Add("Nate Sun") recipient.Type = Outlook.OlMeetingRecipientType.olRequired agendaMeeting.Send() End If End Sub And i rewrote it to #include <Date.au3> $agenda = ObjCreate( "Microsoft.Office.Interop.Outlook.AppointmentItem" ) $agenda.Location = "Arbejdsplads" $agenda.Subject = "Test" $agenda.Body = "Arbejd Arbejd" $agenda.Start = _Now() $agenda.Duration = 60 $agenda.Send() Any can guide me what i need for this to work / what im doing wrong Thx in advance *And maybe a link to a guide for com / autoit for beginners in com Edited November 6, 2006 by Shevilie Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
GaryFrost Posted November 6, 2006 Posted November 6, 2006 (edited) try: #include <Date.au3> Const $olAppointmentItem = 1 Dim $objOL, $agenda, $oMyError $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $objOL = ObjGet("", "Outlook.Application") $agenda = $objOL.CreateItem ($olAppointmentItem) $agenda.Location = "Arbejdsplads" $agenda.Subject = "Test" $agenda.Body = "Arbejd Arbejd" $agenda.Start = _Now() $agenda.Duration = 60 $agenda.Save ;ErrorHandler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "COM Error", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns EndFunc ;==>MyErrFunc Edited November 6, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Shevilie Posted November 6, 2006 Author Posted November 6, 2006 Thank you Seems to work just fine Damn you are fast Any place I can learn about more of com in autoit ?? Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
GaryFrost Posted November 6, 2006 Posted November 6, 2006 Thank you Seems to work just fine Damn you are fast Any place I can learn about more of com in autoit ?? actually I googled "GetNameSpace outlook Appointment"didn't really need the GetNameSpace info, just needed something that would bring up info about the objectgot the GetNameSpace from searching in scripts and scraps for Outlook SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Shevilie Posted November 6, 2006 Author Posted November 6, 2006 Hehe okay But if anybody see's a guide for using com in autoit Then link it Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
GaryFrost Posted November 6, 2006 Posted November 6, 2006 something that might be of interest: Global Enum $olAppointmentItem = 1, $olContactItem, $olTaskItem, $olCityItem = 102 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Shevilie Posted November 6, 2006 Author Posted November 6, 2006 Thx Though i do not know what I shall do with it Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
GaryFrost Posted November 6, 2006 Posted November 6, 2006 (edited) oops that was for pocket pc, here's for regularGlobal Enum $olMailItem, $olAppointmentItem, $olContactItem, $olTaskItem, $olJournalItem, $olNoteItem, $olPostIteminfo from here might helphttp://msdn.microsoft.com/library/default....ffice03_vba.asp Edited November 6, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Shevilie Posted November 6, 2006 Author Posted November 6, 2006 This one confises me you mentioned it and its in the guides im reading GetNameSpace("MAPI") What is that / what does it do ??? Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
GaryFrost Posted November 6, 2006 Posted November 6, 2006 This one confises me you mentioned it and its in the guides im reading GetNameSpace("MAPI")What is that / what does it do ???plenty of information in the link in my previous post SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Shevilie Posted November 6, 2006 Author Posted November 6, 2006 I'll go study then thx for the help Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now