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

This forum is meant for questions and discussions about the X# language and tools
Post Reply
rn@warner-it.com
Posts: 46
Joined: Mon Mar 04, 2019 4:41 pm

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

Post by rn@warner-it.com »

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
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

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

Post by Chris »

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.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply