Using Dates in Outlook

Fozzie
Member Posts: 14
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) ???
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
May the source be with you
0
Comments
-
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. Ernst0 -
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 GiebensRgds
Benny Giebens0 -
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 you0 -
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 GiebensRgds
Benny Giebens0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions