Options

Using Dates in Outlook

FozzieFozzie Member Posts: 14
edited 2000-01-27 in Navision Financials
Hi,
I programmed an Outlook98-automation in C/AL that gets information out of Calendars from specified users. So far so good. But I don't succeed to set a filter on the "start"-date of the items. Normally you can use the VB-method "Restrict", but I guess I have to format my dates...

I have the following code :
txtFilter := '[Start] >= ''' + FORMAT(DateFrom) + ''' AND [Start] <= ''' + FORMAT(DateTo) + '''';
autFilterItems := autItems.Restrict(txtFilter);

Does anyone have a solution (fast) ???
Fozzie
May the source be with you

Comments

  • Options
    Erik_P._ErnstErik_P._Ernst Member Posts: 8
    The support department at Navision Software Denmark created a small ActiveX that you can use for this. Because you have to "translate" Navision's date format into Microsoft's data format and vice versa.
    I couldn't find any copyright or license information on the files, so I guess it Ok to put it here in this forum, so I have sent it in an email to webmaster@mynavison.net, so I hope it's up there soon.


    Best regards,
    Erik P. Ernst
    Best regards,
    Erik P. Ernst
    Navision Online User Group
  • Options
    BennyGiebensBennyGiebens Member Posts: 43
    Can you give us a short description on how you access other users calenders via automation??

    I'm stuck on that one for weeks now and can't seem to find anyone willing to share this information

    Rgds
    Benny Giebens
    Rgds
    Benny Giebens
  • Options
    FozzieFozzie Member Posts: 14
    You'll need some automation variables :
    autApp : automation : 'Microsoft Outlook 98 Object Model'.Application
    autNS : automation : 'Microsoft Outlook 98 Object Model'.NameSpace
    autRec : automation : 'Microsoft Outlook 98 Object Model'.Recipient
    autFolder : automation : 'Microsoft Outlook 98 Object Model'.MAPIFolder
    autItems : automation : 'Microsoft Outlook 98 Object Model'.Items

    Your code should look like this :
    CREATE(autApp);
    autNS := autApp.GetNamespace('MAPI');
    autRec := autNS.CreateRecipient(Name); //Name used in mailserver
    autRec.Resolve;
    //olFolderCalendar = 9 online
    autFolder := autNS.GetSharedDefaultFolder(autRec,9);
    autItems := autFolder.Items;

    Use autItems to get your AppointmentItems, etc.
    I must add that this code is written by my collegue Vincent Bague and that he deserves all credits ! Thanks VB !
    Fozzie
    May the source be with you
  • Options
    BennyGiebensBennyGiebens Member Posts: 43
    Thanks to Fozzie and his collegue Vincent Bague.

    I finaly got over a important step for creating appointments in outlook via automation.

    This is the code i use :

    CREATE(Autapp);
    Autns := Autapp.GetNamespace('MAPI');
    Autrec := Autns.CreateRecipient('MAILUSER'); //Name used in mailserver
    Autrec.Resolve;
    //olFolderCalendar = 9 online
    Autfolder := Autns.GetSharedDefaultFolder(Autrec,9);
    autitem := Autapp.CreateItem(1);
    autitem.Subject('TESTSUBJECT');
    autitem.Start(010200D);
    autitem.Location('BELGIUM');
    autitem.Close(0);
    autitem.Move(Autfolder);
    CLEAR(Autapp);

    Keypart being the move !!!

    2 Problems still stay :
    1) the problem with witch this thread started, how to set a begin and end time
    2) I'cant find the item property 'SHOW TIME AS'

    So if i can get these one resolved, I woumd be very happy !!!


    Rgds
    Benny Giebens
    Rgds
    Benny Giebens
Sign In or Register to comment.