Jump to content

Outlook Com Calendar


 Share

Recommended Posts

Well I've started to write a way to add apointment to Outlook via com, but it doesnt seems to work :P 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 :whistle:

Thx in advance

*And maybe a link to a guide for com / autoit for beginners in com ;)

Edited 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

Link to comment
Share on other sites

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 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.

 

Link to comment
Share on other sites

Thank you ;) Seems to work just fine :P Damn you are fast ;)

Any place I can learn about more of com in autoit ?? :whistle:

actually I googled "GetNameSpace outlook Appointment"

didn't really need the GetNameSpace info, just needed something that would bring up info about the object

got 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.

 

Link to comment
Share on other sites

oops that was for pocket pc, here's for regular

Global Enum $olMailItem, $olAppointmentItem, $olContactItem, $olTaskItem, $olJournalItem, $olNoteItem, $olPostItem

info from here might help

http://msdn.microsoft.com/library/default....ffice03_vba.asp

Edited 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.

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...