Creating an appointment in outlook via automation

BennyGiebensBennyGiebens Member Posts: 43
edited 2009-04-13 in Navision Financials
As promised, here a simple example how to create an appointment via automation in someone else calender. One of the things i still need te know is how to set the flag "SHOW TIME AS", but i'll keep searching.

With thanks to Fozzie and his collegue !!!!!!!!


Automation Globals
Autapp:'Microsoft Outlook 9.0 Object Library'.Application
Autns:'Microsoft Outlook 9.0 Object Library'.NameSpace
Autrec:'Microsoft Outlook 9.0 Object Library'.Recipient
Autfolder:'Microsoft Outlook 9.0 Object Library'.MAPIFolder
autitem:'Microsoft Outlook 9.0 Object Library'.AppointmentItem
OCX Global
DATETIME OCX DateTimeConversion.DateTime

PS. This OCX is from the download on this site. Simply extract the ocx and register it in Financials


CREATE(Autapp);
Autns := Autapp.GetNamespace('MAPI');
Autrec := Autns.CreateRecipient('TESTUSER'); //Name used in mailserver
Autrec.Resolve;
Autfolder := Autns.GetSharedDefaultFolder(Autrec,9);
autitem := Autapp.CreateItem(1);
autitem.Subject('TESTSUBJECT');
stdate := '01/02/00';
sttime := '12:00:00';
DATETIME.SetStart(autitem,stdate,sttime);
sttime := '13:00:00';
DATETIME.SetEnd(autitem,stdate,sttime);
autitem.Move(Autfolder);
autitem.Close(0);
CLEAR(Autapp);


Hope that this is helpfull for someone !!

Rgds
Benny Giebens


[This message has been edited by BennyGiebens (edited 31-01-2000).]
Rgds
Benny Giebens

Comments

  • FozzieFozzie Member Posts: 14
    Just remember where you've find the code !!! <img border="0" title="" alt="" src="images/smiles/icon_smile.gif" />
    Fozzie
    May the source be with you
  • TheDoubleHTheDoubleH Member Posts: 67
    The way I did it once was:

    OutlookAftale.BusyStatus := Status;

    Status is an option, with optiostring:
    Availeble,For the time beeing,Busy,Out of office

    * I'm not sure if my option string are right, as I am using a Danish Version <img border="0" title="" alt="" src="images/smiles/icon_smile.gif" />




    Kind Regards

    Henrik Helgesen,
    Navision Solution Developer
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Great Minds Discuss Ideas,
    Average minds discuss events
    Small minds discuss people (With Malicious Intention)

    Admiral Hyman Rickover, US Navy<HR></BLOCKQUOTE>
    Kind Regards

    Henrik Helgesen,
    President | Helgesen Consulting
    about.me | LinkedIN
  • BennyGiebensBennyGiebens Member Posts: 43
    Thnks Ernst, thats the property that does it.


    Rgds
    Benny Giebens
    Rgds
    Benny Giebens
  • bavani_umabavani_uma Member Posts: 9
    I tried the above code but its showing a run time error.
    The call to Getshareddefaultfolder failed.MS Outlook returned the error OPeration Failed.
    Please help
Sign In or Register to comment.