Importing and Exporting using .NET API

Hello Everyone,

I am having trouble figuring out how to import and export to and from Sage 50 Quantum using the US SDK. I have gone through several of the sample apps and I am just not seeing how things are transacting. I want to import CSV files in and out. I have so far been able to connect to Sage and open up a company. I have also been able to make my connection to my Filemaker Pro Database that I need to transact with and pull in and out of that. So I am down to my connection with Sage and have been stopped in my tracks. Is there any documentation that covers this in greater detail or is there someone willing to share some sample code that has worked for them? Thanks for your time and talents in response to this question.

  • 0

    Here is the method that I was able to create to get things connected to Sage. Hope it might help someone else out there.

    private static Company OpenPeachtree()
    {
    //main session into the sage 50 app
    PeachtreeSession apiSession = new PeachtreeSession();
    // the active Sage 50 Company
    Company companyContext = null;

    //start the session
    //Add your company key here
    apiSession.Begin("");

    //Get companyIdentifer for sample company
    CompanyIdentifierList m_companyIdList = apiSession.CompanyList();
    CompanyIdentifier companyId = m_companyIdList.Find(
    delegate (CompanyIdentifier o)
    {
    //Change to YOUR company name here
    return o.CompanyName == "SBD Manufacturing & Distribution";

    });

    //Set AuthResult to current authorization statis
    AuthorizationResult AuthResult = apiSession.RequestAccess(companyId);

    //Check to see if authorization was granted
    if (AuthResult == AuthorizationResult.Granted)
    {
    //Open the company if authorization was granted
    companyContext = apiSession.Open(companyId);
    MessageBox.Show("Connection to Sage Successful");
    return companyContext;
    }
    else
    {
    MessageBox.Show("Connection to Sage Failed.");
    return null;
    }
    }

  • FormerMember
    0 FormerMember in reply to MarkB_

    Hi Mark,

    I know it has been a year, but I am trying to do something similar (import csv files). I am able to access the company with the SDK. I was wondering if you were able to accomplish this and if so, if you could maybe guide me in the right direction.

    Thanks!