email link to file in a repository
I'm using ThingWorx 9.3.9
My service creates a file in a file repository. I would then like the service to email a link to the file that the user can click on to download the file.
I've tried using the repository's GetFileListingWithLinks service that returns an infotable that has a hyperlink field named downloadLink. However, the value that is returned is in this format:
/Thingworx/FileRepositories/MLLC.Common.Repository/LineZRouteID_2025-08-07.csv
When I email that value Outlook does not recognize that value as a link. So, I think I need to somehow convert it to this format:
http://thingworxu15/Thingworx/FileRepositories/MLLC.Common.Repository/LineZRouteID_2025-08-07.csv
Here's my code. The commented lines show the ways I tried to get it to email a proper link.
// result: INFOTABLE dataShape: "FileSystemFileWithLinks"
let fileInfo = Things["MLLC.Common.Repository"].GetFileListingWithLinks({
path: "/" /* STRING */ ,
nameMask: validationID + "_" + formattedDate + ".csv" /* STRING */
});
//linkToCSV = "<a href=" + fileInfo.downloadLink + "></a>";
//linkToCSV = "<a href=" + fileInfo.downloadLink.toString() + "></a>";
//linkToCSV = fileInfo.downloadLink.removeAttribute('href');
linkToCSV = fileInfo.downloadLink;
let body = "<html><body>" + linkToCSV + "</body></html>";
// send message
Things[me.emailThingName].SendMessage({
cc: undefined /* STRING */ ,
bcc: undefined /* STRING */ ,
subject: validationID + " Updates Needed" /* STRING */ ,
from: undefined /* STRING */ ,
to: emailList /* STRING */ ,
body: body /* HTML */
});
However, this is what I get - no link.

I know that I can build the link, but that would require the code to be updated with the new host as we move from Dev to Test to Production. Something, I'd like to avoid.
Thanks,
Steve

