Hi guys,
I am trying to port my Vulcan app that worked to X# however I get error after error. Currently my problem is Interop to Outlook. Could you please indicate what I need to upload for assistance? I had everything working in Viulcan.Net but strangely I get compile errors of
code thatz is running in my application the Try and Catch routines for Database I keep getting errors and cannot implement any mail features in X#. I cannot even get this simple code to run.
LOCAL oApp AS Microsoft.Office.Interop.Outlook.Application
LOCAL oAppt AS _MailItem
LOCAL oItemType AS OlItemType
oApp := Microsoft.Office.Interop.Outlook.Application{}
oItemType := OlItemType.OlMailitem
oAppt:= (_Mailitem)oApp:CreateItem(oItemtype)
*oContact := (ContactItem)oOutlook:CreateItem(oItemType)
*oAppt := oApp:CreateItem(oItemtype)
oAppt:@@To := "rn@warner-it.com"
oAppt:Subject := "Test Mail"
oAppt:Body := "Hello This is a Test Mail"
oAppt:Send()
// Clean up.
oApp := Null_oBject
oAppt := Null_oBject
When you icliude the outlook Interop this code below is show as errors and this code works well currently without Outlook.Interop
TRY
SELF:Tda:InsertCommand := OledbCommand{cStatement2, oConn1}
cmd := SELF:Tda:InsertCommand
cmd:ExecuteNonQuery()
*messagebox.show("Alle Daten Satze erfolgreich gelöscht !!!! ")
CATCH ex AS exception
messageBox.show("Fehler beim löschen !!! "+ex:Message:ToString())
END TRY
I would appreciaqte some help as I am currently stuck
Thanks and Regards
Raymond
Trying send mails and attachments via Outlook
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Trying send mails and attachments via Outlook
Hi Raymond,
I am not that clued up with Interop and Outlook. Tried to help, but nothing from a non-Interop user that I can find fault with.
Guys? anybody that can help?
I am not that clued up with Interop and Outlook. Tried to help, but nothing from a non-Interop user that I can find fault with.
Guys? anybody that can help?
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Trying send mails and attachments via Outlook
Hi Raymond,
I had to change the code a bit, but for me sending mails works.
This is my code actually:
I had to include MSOutl.DLL and System.Windows.Forms in my application.
The complete application is attached here (as XIDE export file): Wolfgang
I had to change the code a bit, but for me sending mails works.
This is my code actually:
Code: Select all
using Microsoft.Office.Interop.Outlook
using System.Windows.Forms
class OutlookApp
static method InteropOutlook() as void
local oApp as Microsoft.Office.Interop.Outlook.Application
local oAppt as _MailItem
local oItemType as OlItemType
oApp := Microsoft.Office.Interop.Outlook.Application{}
oItemType := OlItemType.OlMailitem
oAppt:= (_Mailitem)oApp:CreateItem(oItemtype)
oAppt:@@To := "wr@meles.net"
oAppt:Subject := "Test Mail"
oAppt:Body := "Hello This is a Test Mail"
oAppt:Send()
// Clean up.
oApp := Null_oBject
oAppt := Null_oBject
// When you icliude the outlook Interop this code below is show as errors and this code works well currently without Outlook.Interop
try
//self:Tda:InsertCommand := OledbCommand{cStatement2, oConn1}
//cmd := self:Tda:InsertCommand
//cmd:ExecuteNonQuery()
messagebox.show("Alle Daten Satze erfolgreich gelöscht !!!! ")
catch ex as System.exception
messageBox.show("Fehler beim löschen !!! "+ ex:Message:ToString())
end try
return
end class
The complete application is attached here (as XIDE export file): Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Trying send mails and attachments via Outlook
Please also include what error you are getting!
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
Trying send mails and attachments via Outlook
Hello Wolfgang,
I am sorry to say that implementing your changes to my programme has had no impact it is still showing errors. I tried sending a mail from your example programme with my mail address and I am afraid I did not receive a mail.
Here is a screen shot of the error it is saying that my Try and catch routines are not valid when I include the Outlook. Interop. Can you please tell me what the solution can be ??
Thanks
Raymond
I still get the Try Catch errors I do not know why I am going to make a mini version of the programe and attach it to the current problem hope that is ok. Will give you an info after i finish.
Raymond
I am sorry to say that implementing your changes to my programme has had no impact it is still showing errors. I tried sending a mail from your example programme with my mail address and I am afraid I did not receive a mail.
Here is a screen shot of the error it is saying that my Try and catch routines are not valid when I include the Outlook. Interop. Can you please tell me what the solution can be ??
Thanks
Raymond
I still get the Try Catch errors I do not know why I am going to make a mini version of the programe and attach it to the current problem hope that is ok. Will give you an info after i finish.
Raymond
Trying send mails and attachments via Outlook
Raymond, unfortunately you forgot the attachment! Yes, of course it is OK to post here the app!
Edit: Ah, I see you sent it in an email. It's what Wolfgang said.
Edit: Ah, I see you sent it in an email. It's what Wolfgang said.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Trying send mails and attachments via Outlook
Hi Raymond,
please look at my "catch" statement:
It seems the Microsoft.Office.Interop.Outlook namespace contains an Exception class that is not inherited from the System.Exception class that is needed for the catch statement.
Wolfgang
please look at my "catch" statement:
Code: Select all
catch oEx as System.Exception
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
Trying send mails and attachments via Outlook
Hi Chris,
I am using your IDE that you created I have done this since Dieter introduced me to Vulcan.net. I have to also tell you that I cannot use
then current version to go to the methods with the right mouse click it does not give me the option. Anyway here is the error message.
I am using your IDE that you created I have done this since Dieter introduced me to Vulcan.net. I have to also tell you that I cannot use
then current version to go to the methods with the right mouse click it does not give me the option. Anyway here is the error message.
- Attachments
-
- Compile_Error_Outlook_Interop.pdf
- (351.77 KiB) Downloaded 102 times
Trying send mails and attachments via Outlook
Hi Raymond,
Please see Wolfgang's reply above, as he said, apparently the Outlook library defines an Exception class as well. To disambiguate, use System,.Exception as Wolfgang pointed out.
About right-click not showing "Go to definition", does this happen with all classes and methods? Or with specific ones?
Please see Wolfgang's reply above, as he said, apparently the Outlook library defines an Exception class as well. To disambiguate, use System,.Exception as Wolfgang pointed out.
About right-click not showing "Go to definition", does this happen with all classes and methods? Or with specific ones?
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Trying send mails and attachments via Outlook
Hi Raymond,
please read my message!
The compile error message says it clearly: the Microsoft.Office.Interop.Outlook.Exception class cannot be used with a catch statement.
Therefore you need to fully qualify it as
Wolfgang
please read my message!
The compile error message says it clearly: the Microsoft.Office.Interop.Outlook.Exception class cannot be used with a catch statement.
Therefore you need to fully qualify it as
Code: Select all
System.Execption
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it