Outlook automation in combination with Navision NAS 4.0 SP3
Fbx
Member Posts: 2
Hi All,
I am having troubles using the Outlook automation when using the NAS. I wrote some code to create an appointment trough automation. When I run the codeunit manually it works fine, without having to confirm 'outlook wants to send an e-mail' message.
When i try to run my codeunit with the NAS, it hangs on following line:
paut_Item.Send (this is the AppointmentItem variable)
Is there a limitation of the NAS that I am not aware about, or IS it possible to use outlook automation with the NAS and am I doing something wrong?
A piece of my code:
CREATE(gaut_App);
laut_Ns := gaut_App.GetNamespace('MAPI');
laut_Rec := laut_Ns.CreateRecipient('PLANNING'); //Name used in mailserver
gaut_Folder := laut_Ns.GetSharedDefaultFolder(laut_Rec,9);
laut_Item := gaut_App.CreateItem(1);
pdat_DateFrom := TODAY - lint_Temp;
laut_Item.Start := DATI2VARIANT(pdat_DateFrom, ltim_Time);
laut_Item.Subject := prec_ActionLine."Project Leader" + ': ' + prec_ActionLine."Line No.";
laut_Item.Body := 'Dit actiepunt werd u toegewezen door ' + prec_ActionLine."Created By" +
FORMAT(lchr_13) + 'Omschrijving actiepunt: ' + prec_ActionLine.Description;
laut_Item.Duration := 30;
laut_Item.Categories('VCO alert');
laut_Item.ReminderSet := FALSE;
laut_Item.RequiredAttendees := prec_Resource."E-mail";
laut_Item.MeetingStatus := 1;
laut_Item.Duration := 30;
IF pdat_DateFrom <> pdat_DateTill THEN BEGIN
laut_Reccur := paut_Item.GetRecurrencePattern;
laut_Reccur.RecurrenceType := 0;
pdat_DateFrom := TODAY - lint_Temp;
laut_Reccur.PatternStartDate := DATI2VARIANT(pdat_DateFrom, ltim_Time);
lint_Temp := TODAY - pdat_DateTill;
pdat_DateTill := TODAY - lint_Temp;
laut_Reccur.PatternEndDate := DATI2VARIANT(pdat_DateTill, ltim_Time);
END;
laut_Item.Save;
laut_Item.Send;
To repeat myself: when running this code manually, no probs!!
Thanks in advance.
I am having troubles using the Outlook automation when using the NAS. I wrote some code to create an appointment trough automation. When I run the codeunit manually it works fine, without having to confirm 'outlook wants to send an e-mail' message.
When i try to run my codeunit with the NAS, it hangs on following line:
paut_Item.Send (this is the AppointmentItem variable)
Is there a limitation of the NAS that I am not aware about, or IS it possible to use outlook automation with the NAS and am I doing something wrong?
A piece of my code:
CREATE(gaut_App);
laut_Ns := gaut_App.GetNamespace('MAPI');
laut_Rec := laut_Ns.CreateRecipient('PLANNING'); //Name used in mailserver
gaut_Folder := laut_Ns.GetSharedDefaultFolder(laut_Rec,9);
laut_Item := gaut_App.CreateItem(1);
pdat_DateFrom := TODAY - lint_Temp;
laut_Item.Start := DATI2VARIANT(pdat_DateFrom, ltim_Time);
laut_Item.Subject := prec_ActionLine."Project Leader" + ': ' + prec_ActionLine."Line No.";
laut_Item.Body := 'Dit actiepunt werd u toegewezen door ' + prec_ActionLine."Created By" +
FORMAT(lchr_13) + 'Omschrijving actiepunt: ' + prec_ActionLine.Description;
laut_Item.Duration := 30;
laut_Item.Categories('VCO alert');
laut_Item.ReminderSet := FALSE;
laut_Item.RequiredAttendees := prec_Resource."E-mail";
laut_Item.MeetingStatus := 1;
laut_Item.Duration := 30;
IF pdat_DateFrom <> pdat_DateTill THEN BEGIN
laut_Reccur := paut_Item.GetRecurrencePattern;
laut_Reccur.RecurrenceType := 0;
pdat_DateFrom := TODAY - lint_Temp;
laut_Reccur.PatternStartDate := DATI2VARIANT(pdat_DateFrom, ltim_Time);
lint_Temp := TODAY - pdat_DateTill;
pdat_DateTill := TODAY - lint_Temp;
laut_Reccur.PatternEndDate := DATI2VARIANT(pdat_DateTill, ltim_Time);
END;
laut_Item.Save;
laut_Item.Send;
To repeat myself: when running this code manually, no probs!!
Thanks in advance.
0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions