Sandbox.IO in Functions Workflows

Looking at Santi’s Github article Epicare pointed me to, the use of System.IO is being replaced with Sandbox.IO. Here is the link to the Github Paths.cs doc.
Revisions · Paths in custom code · GitHub

I am not finding the assembly reference to Sandbox.IO so not sure what Assembly reference I need to add and what using statement. I am reaching out to contacts I have at Epicor to see if there is more information available.

I have not seen one either. In a pinch…

FileStream fs = Sandbox.IO.File.Open(...

OutText = Sandbox.IO.File.ReadAllText(...

:person_shrugging:

I just got the 411 on this from a kind soul in Epicor Development who works with Santi occasionally.

The reference needed is Ice.Customizaztion.Sandbox.dll and it was not cooked into the Framework until 2025.2.x. I just stood up a 2025.2 server and was able to test it. I am able to find the assembly reference and add using Sandbox.IO;

2 Likes

It’s referenced internally, no need to add it.

3 Likes

Still not out of the woods. Even after adding the assembly reference and the using, it is still missing something.

I tried Marks code but get the same missing reference error.

I have asked for help on this so hopefully they will have mercy on me.

In a function, use this.Sandbox.IO, see this post for some info, you don’t need a reference for it.
Sandbox.IO doesn’t replace all of System.IO, just the parts they don’t want you to use, you still can use a reference to System.IO and use the ‘unbanned’ bits of it.

(ps. this works since at least 2025.1, don’t remember if 2024.2 also)

1 Like

This gets me closer. What is throwing me is that there is no code completion (Ctrl+Space) after this.Sandbox, you just have to have to have the correct syntax for it to work.

2 Likes

I mean, yeah. You might be asking a bit much of Epicor now :wink:
I use the help web page for reference, I just assume that this is an exhaustive list of Sandbox.IO methods since we don’t have anything else to go on… like code completion :slight_smile: (the link below works if you first access any help page from within your epicor instance, or you can search for it in the epicor help)

It states that two server folders are available (UserData and CompanyData) but, you can write to FileShare also, so i’m sure there are plenty of other undocumented things :slight_smile:

1 Like

Thanks so much. I am getting it pieced together now. The 2025.2 upgrade is going to be a bit of a slog but I am confident I can pull it off and get rid of the warnings related to System.IO.

2 Likes

I have a post somewhere that fixes that lol.

Let me see if I can find it.

1 Like
7 Likes

Meant to get back to you with a thanks on this. 2025.2.x seems to be shutting down the System.IO stuff they have deemed Cloud unfriendly so this really helps.

2 Likes