Epicor 9 C# Change CurrentCompany in session

I’m writing C# in an external dll for E9 and and tapping into the session for a specific user. I want to control which company my session is logging in on while the code executes. It’s logging into the wrong company, and I need it to access all companies.

I’m not sure why this didn’t come up with answers in google searches, or maybe it’s just super common knowledge that I never got the memo on, but you literally just set the attribute for the session.

using (Session EpiSession = new Session(“USER”, “PASS”, “AppServerDC://SERVER:1234”, Session.LicenseType.Default))
{

EpiSession.CompanyID = “ComID”;

}