Dotnet var Outlook Application

Avallack
Member Posts: 18
Hi all,
I would like consume a interop outlook variable to read my mails from Navision 2013 any success...
Name DataType Length Subtype
Application DotNet Microsoft.Office.Interop.Outlook.Application.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
NameSpace DotNet Microsoft.Office.Interop.Outlook._NameSpace.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
Code :
Application := Application;
NameSpace := Application.GetNamespace('MAPI');
This code give me an error .. "Application is not instantiate" , i dont understand where is my error because from a console application, it's work!
Thank for your help.
I would like consume a interop outlook variable to read my mails from Navision 2013 any success...
Name DataType Length Subtype
Application DotNet Microsoft.Office.Interop.Outlook.Application.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
NameSpace DotNet Microsoft.Office.Interop.Outlook._NameSpace.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
Code :
Application := Application;
NameSpace := Application.GetNamespace('MAPI');
This code give me an error .. "Application is not instantiate" , i dont understand where is my error because from a console application, it's work!

Thank for your help.
Navision Technical Consultant & .Net Developer
0
Comments
-
solved, thx.Navision Technical Consultant & .Net Developer0
-
HI...
how do you solved the problem?
I have the same one.
I try do use .Net
Microsoft.Office.Interop.Outlook.Application.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
for creating Appointments with RTC.
I already tried to use the AppointmentClass for creating the Object, but still not working.
olItemType := olItemType.olAppointmentItem;
oAppClass := oAppClass.ApplicationClass();
IF ISNULL(outlookApp) THEN BEGIN
outlookApp := oAppClass;
END;
oAppointment := oAppointment;
oAppointment := outlookApp.CreateItem(olItemType);
oAppointment.Subject := 'This is the subject for my appointment';
oAppointment.Body := 'This is the body text for my appointment';
oAppointment.Location := 'Appointment location';
// Set the start date
oAppointment.Start := CREATEDATETIME(101013D,100000T);
// End date
oAppointment."End" := CREATEDATETIME(101013D,120000T);
// Set the reminder 15 minutes before start
oAppointment.ReminderSet := TRUE;
oAppointment.ReminderMinutesBeforeStart := 15;
//Setting the sound file for a reminder:
oAppointment.ReminderPlaySound := TRUE;
//set ReminderSoundFile to a filename.
//Setting the importance:
//use OlImportance enum to set the importance to low, medium or high
//oAppointment.Importance := Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
//oAppointment.BusyStatus := Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
oAppointment.Save();
oMailItem := oAppointment.ForwardAsVcal();
oMailItem."To" := 'xxx'
oMailItem.Send();
Any idears?0 -
I'm trying your code, on my side, it's worked. I think your turn on "runonclient" property and instantiate correctly your variable. There are some mistake or confusion between interface and class.
Below the code who worked :
Name DataType Subtype Length
outlookApp DotNet Microsoft.Office.Interop.Outlook.Application.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
oAppClass DotNet Microsoft.Office.Interop.Outlook.ApplicationClass.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
oAppointment DotNet Microsoft.Office.Interop.Outlook.AppointmentItem.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
oAppointmentClass DotNet Microsoft.Office.Interop.Outlook.AppointmentItemClass.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
olItemType DotNet Microsoft.Office.Interop.Outlook.OlItemType.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
oMailItem DotNet Microsoft.Office.Interop.Outlook.MailItem.'Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
olItemType := olItemType.olAppointmentItem;
outlookApp := oAppClass.ApplicationClass();
oAppointment := oAppointmentClass;
oAppointment := outlookApp.CreateItem(olItemType);
oAppointment.Subject := 'This is the subject for my appointment';
oAppointment.Body := 'This is the body text for my appointment';
oAppointment.Location := 'Appointment location';
// Set the start date
oAppointment.Start := CREATEDATETIME(101013D,100000T);
// End date
oAppointment."End" := CREATEDATETIME(101013D,120000T);
// Set the reminder 15 minutes before start
oAppointment.ReminderSet := TRUE;
oAppointment.ReminderMinutesBeforeStart := 15;
//Setting the sound file for a reminder:
oAppointment.ReminderPlaySound := TRUE;
//set ReminderSoundFile to a filename.
//Setting the importance:
//use OlImportance enum to set the importance to low, medium or high
//oAppointment.Importance := Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
//oAppointment.BusyStatus := Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
oAppointment.Save();
oMailItem := oAppointment.ForwardAsVcal();
oMailItem."To" := 'To mail';
oMailItem.Send();Navision Technical Consultant & .Net Developer0
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