Harbour dialect error XS1510 A REF or OUT value must be an assignable variable

This forum is meant for questions and discussions about the X# language and tools
Post Reply
RolWil
Posts: 68
Joined: Mon Jul 18, 2022 3:16 am

Harbour dialect error XS1510 A REF or OUT value must be an assignable variable

Post by RolWil »

Hello XSharp sleuths;
I have a library with common functions. In this case, I'm adding a function to send emails; my pervious post regarding using Outlook eened up 'working; but not as I had wanted; I wanted the email to be created in the Outlook user's 'Drafts' folder; I changed the code and have it working no problem in native c# .Net in VS. But then I tried to bringing it over to my Harbour dialect project and am getting error:
"XS1510 A REF or OUT value must be an assignable variable " on the line with

Code: Select all

mail := (Outlook.MailItem) 
 oApp:CreateItemFromTemplate(@"E:AppsHarborClipperTargetDataTestsOutlookTemplatesMicheledefault.oft, folder)
in the code below. I'm assuming the issue is the 'folder' object I'm passing.

The project dialect is Harbour; I’ve added the following references:
XSharp.Core
XSharp.RT
Microsoft.Office.Interop.Outlook

I have:

Code: Select all

using Outlook := Microsoft.Office.Interop.Outlook
using System.Runtime.InteropServices     

FUNCTION SendEmail() AS VOID  
            
            LOCAL oApp AS Outlook.Application
            oApp := Outlook.Application{}

            LOCAL folder AS Outlook.Folder
            folder := (Outlook.Folder) oApp:ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts)

            LOCAL mail AS Outlook.MailItem
            mail := (Outlook.MailItem) oApp:CreateItemFromTemplate(@"E:AppsHarborClipperTargetDataTestsOutlookTemplatesMicheledefault.oft", folder)
            mail:Subject := "testing 123"

    RETURN
Thanks for any tips.
User avatar
robert
Posts: 4540
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Harbour dialect error XS1510 A REF or OUT value must be an assignable variable

Post by robert »

Roland,
Remove the "@" character in front of the string.
That character is needed in C# but not in X#.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
RolWil
Posts: 68
Joined: Mon Jul 18, 2022 3:16 am

Harbour dialect error XS1510 A REF or OUT value must be an assignable variable

Post by RolWil »

Thanks Robert, that was indeed the problem!

I must say, I am grateful that you folks have developed XSharp and continue to do so and support it so well. Many thanks,

Cheers
Roland
Post Reply