fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Hi Guys Problems compiling outlook code in X# Can anyone help please

Hi Guys Problems compiling outlook code in X# Can anyone help please 2 months 2 weeks ago #8277

  rn@warner-it.com's Avatar Topic Author rn@warner-it.com Offline Posts: 27
Hi Guys and Chris,
Sorry to bother you again but I am afraid I cannot get the code to compile properly in X# there seems to always be an error regardless which variant I try this simple code also wont work. Yesterday I sent you something similar for the contacts to show the contacts in outlook I cannot get it to compile error free. Some of the code that I had for Vulcan use to work but it does not in X# because of compile errors. Can you please help. Is it possible to ask your colleagues if they are also encountering the same problems. There must be a possibility of a general fix. Code that used to work Vulcan 32 bit just has compile errors in X#.

Thanks
Raymond
FUNCTION Calendar() AS VOID

/* Original Code VB.Net Chris Cannot compile it error free in X#
Dim myNamespace As Outlook.NameSpace

Set myNamespace = Application.GetNamespace("MAPI")

Set Application.ActiveExplorer.CurrentFolder = _

myNamespace.GetDefaultFolder(olFolderCalendar)
*/

LOCAL _myNamespace AS Microsoft.Office.Interop.Outlook.NameSpace //Outlook.NameSpace
LOCAL outApplication AS Microsoft.Office.Interop.Outlook.Application

_myNamespace := outApplication.GetNamespace("MAPI")


outApplication.ActiveExplorer.CurrentFolder := _myNamespace.GetDefaultFolder.olFolderCalendar //(olFolderCalendar)

RETURN
error XS0119: 'Microsoft.Office.Interop.Outlook._Application.ActiveExplorer()' is a method, which is not valid in the given context 370,5 Ray_Outlook.prg FormApp6
error XS0119: 'Microsoft.Office.Interop.Outlook._NameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders)' is a method, which is not valid in the given context 370,5 Ray_Outlook.prg FormApp6

Please Log in or Create an account to join the conversation.

Hi Guys Problems compiling outlook code in X# Can anyone help please 2 months 2 weeks ago #8278

  Chris's Avatar Chris Offline Posts: 1181
Hi Raymond,

I think the differences are due to different versions of the office dlls, you are probably using a different version than what the sample is using. The error message says that "ActiveExplorer" is a method, in which case you need to use "()" to call it, so try changing your code to:

outApplication:ActiveExplorer():CurrentFolder := .....

does it work this way?

Btw, please do not create new threads for the same topic, better just reply to the ones you have already started, it's easier to manage everything this way.
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

  • Page:
  • 1