Trying send mails and attachments via Outlook
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
Trying send mails and attachments via Outlook
Hi Chris,
Currently with all and I find it cumbersome because I have to scroll up and down to find the Methods.
Chris I did not quite understand what I should exactly do to solve my outlook problem.
I just posted Wolfgang that TRY shows an error. This is code that is currently working. Only when I add the Outlook:interop I then get the erros and I have a lot of Try and catch routine in my source code.
Regards,
Raymond
Currently with all and I find it cumbersome because I have to scroll up and down to find the Methods.
Chris I did not quite understand what I should exactly do to solve my outlook problem.
I just posted Wolfgang that TRY shows an error. This is code that is currently working. Only when I add the Outlook:interop I then get the erros and I have a lot of Try and catch routine in my source code.
Regards,
Raymond
Trying send mails and attachments via Outlook
Hi Raymond,
it seems I'm ways too stupid to explain what your problem really is.
Maybe it is too much to TRY to put
instead of
in your code?
Wolfgang
it seems I'm ways too stupid to explain what your problem really is.
Maybe it is too much to TRY to put
Code: Select all
catch oEx as System.Exception
Code: Select all
catch oEx as 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
- lumberjack
- Posts: 729
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Trying send mails and attachments via Outlook
Hi Wolfgang,
Don't you mean his CATCH statement should be:
He does have System.Exceptonwriedmann wrote: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 asCode: Select all
System.Execption
Don't you mean his CATCH statement should be:
Code: Select all
CATCH oEx AS Microsoft.Office.Interop.Outlook.Exception
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Trying send mails and attachments via Outlook
Hi Raymond,
unfortunately it seems you need a full explanation and I'm not experienced enough to do that.
Microsoft has put a class called Exception in the Microsoft.Office.Interop.Outlook namespace, and if you include that interop, the compiler takes that class instead of the needed System.Exception class.
Therefore, if you include the interop in your application, you NEED to specify the fully qualified class name.
Maybe Vulcan has another sequence, but IMHO the X# compiler is right here.
Wolfgang
unfortunately it seems you need a full explanation and I'm not experienced enough to do that.
Microsoft has put a class called Exception in the Microsoft.Office.Interop.Outlook namespace, and if you include that interop, the compiler takes that class instead of the needed System.Exception class.
Therefore, if you include the interop in your application, you NEED to specify the fully qualified class name.
Maybe Vulcan has another sequence, but IMHO the X# compiler is right here.
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
Hi Johan,
the compiler is taking the exception class from the interop assembly, and that class cannot be used in the catch statement.
When I tried to compile the code on my machine, it gave exactly the same error until I added the fully qualified class name.
Wolfgang
the compiler is taking the exception class from the interop assembly, and that class cannot be used in the catch statement.
When I tried to compile the code on my machine, it gave exactly the same error until I added the fully qualified class name.
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
Hi Rymond,
Ah, I understand now, it's just that you need to compile the app first once. When you do that, then you should be able to use right-click for the GoTo Definition option to appear. Btw, you can also put the editor cursor on the method you want to go to its definition and press Alt+Right button, this searches by text and should get you to the method. Also you can use Alt + Left key for returning back.
As for the compiler error, just change the code
CATCH ex AS exception
to
CATCH ex AS System.Exception
(there was a typo earlier)
Ah, I understand now, it's just that you need to compile the app first once. When you do that, then you should be able to use right-click for the GoTo Definition option to appear. Btw, you can also put the editor cursor on the method you want to go to its definition and press Alt+Right button, this searches by text and should get you to the method. Also you can use Alt + Left key for returning back.
As for the compiler error, just change the code
CATCH ex AS exception
to
CATCH ex AS System.Exception
(there was a typo earlier)
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
Hi Chris,
Thanks form the Info will Try it all out.
Raymond
Thanks form the Info will Try it all out.
Raymond
- lumberjack
- Posts: 729
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Trying send mails and attachments via Outlook
Guys,
I think we sometimes (see how we battled with Jeff) don't have the full picture.
I had the complete file and I believe what happened was this.
The Vulcan code was:
However, in the file as was send to me it had:
I make my assumption because there were a lot of commented lines like:
Hence, in the "original" code, there was no way the compiler could get confused with which Exception to use. I think both Vulcan and X# treated it the same, there was however a difference how the USING statement was defined.
Raymond, don't see this as directed against you. I just know from experience, my own Vulcan code compiled in 99% of cases as is, except where X# introduced something more strict, or highlighted a "bug" in Vulcan or where I had my own #command to emulate a feature that was not supported in Vulcan but was now standard in X#. Had to remove my # command and slightly adapt code to adhere to the X# implementation. One I can think of now was my #command around PROPERTY xxx AS INT GET SET y, slight difference in how I did it and how it was implemented in X#.
Johan
PS: Please check this and let us know the result.
I think we sometimes (see how we battled with Jeff) don't have the full picture.
I had the complete file and I believe what happened was this.
The Vulcan code was:
Code: Select all
USING Microsoft.Office.Interop
Code: Select all
USING Microsoft.Office.Interop.Excel // etc.
Code: Select all
LOCAL oApp AS ApplicationClass
//LOCAL oApp AS Excel.ApplicationClass
Raymond, don't see this as directed against you. I just know from experience, my own Vulcan code compiled in 99% of cases as is, except where X# introduced something more strict, or highlighted a "bug" in Vulcan or where I had my own #command to emulate a feature that was not supported in Vulcan but was now standard in X#. Had to remove my # command and slightly adapt code to adhere to the X# implementation. One I can think of now was my #command around PROPERTY xxx AS INT GET SET y, slight difference in how I did it and how it was implemented in X#.
Johan
PS: Please check this and let us know the result.
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Trying send mails and attachments via Outlook
Raymond,
Make sure that the "bitness" of your app and outlook match: If you have a 32 bits version of outlook then you must also use a 32 bits (x86) version of your app. If your outlook is 64 bits then you will also need a 64 bits version of your app.
Robert
Make sure that the "bitness" of your app and outlook match: If you have a 32 bits version of outlook then you must also use a 32 bits (x86) version of your app. If your outlook is 64 bits then you will also need a 64 bits version of your app.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Trying send mails and attachments via Outlook
Hi Robert,
Fortunately you can overcome the bitness problem with COM.
My sample works in 64 bit mode, and my Outlook 2010 is 32 bit.
And COM is the only possibility to send emails through Outlook 64 bit from VO Applications.
Wolfgang
Fortunately you can overcome the bitness problem with COM.
My sample works in 64 bit mode, and my Outlook 2010 is 32 bit.
And COM is the only possibility to send emails through Outlook 64 bit from VO Applications.
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