This tutorial will get you up and running quickly with the Sage Intacct SDK for .NET.

Make sure you meet the system requirements before continuing.

Set up

  1. Download and install .NET Core 2.0 SDK, if you do not already have it installed.

  2. Download or clone the Sage Intacct SDK for .NET examples.

  3. Open the intacct-sdk-net-examples.sln solution file in your IDE of choice (Rider, Visual Studio 2017, etc.). This will display one project, Intacct.Examples, which is a .NET Core console application.

    For Visual Studio, you need to choose .NET Core cross-platform development. For Rider, .NET Core is the default.

  4. Open the Intacct.Examples folder and note that the Intacct.Examples.csproj file specifies the Sage Intacct SDK for .NET as a dependency:

    <PackageReference Include="Intacct.SDK" Version="2.0.0" />
  5. Depending on your IDE, you might need to install any referenced packages. For example, with Visual Studio community, right click on the Solution file and choose Restore NuGet Packages.

    This downloads the Sage Intacct SDK for .NET libraries and dependencies.

  6. Create a credentials.ini file in the Intacct.Examples project folder and provide your developer/sandbox credentials as follows:

    sender_id = "mysenderid"
    sender_password = "mysenderpassword"
    company_id = "mycompanyid"
    user_id = "myuserid"
    user_password = "myuserpassword"

    The default profile is automatically used unless overridden in the ClientConfig or by environment variables.

    The credentials file is excluded from source control via the .gitignore file. You should take precautions to secure this file.

    If you get a file-not-found error when running the examples in Visual Studio, right click on the credentials.ini file and change its property from Do not copy to one of the other choices.

Understand the code

  1. Take a look at Bootstrap.cs in the project root and note that it:

    • Has a static Logger() function for setting up an NLog logger:

      public static ILogger Logger()
          FileTarget target = new FileTarget
              FileName = "${basedir}/logs/intacct.log"
          SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug);
          ILogger logger = LogManager.GetLogger("intacct-sdk-net-examples");
          return logger;
    • Has a static Client() function for setting up a client config that relies on your credentials file and returns a new online client that uses the client config:

      public static OnlineClient Client(ILogger logger)
          ClientConfig clientConfig = new ClientConfig()
              ProfileFile = Path.Combine(Directory.GetCurrentDirectory(), "credentials.ini"),
              Logger = logger,
          OnlineClient client = new OnlineClient(clientConfig);
          return client;
  2. Open Program.cs and note that it is the Main() function for your console application. This program wraps the examples and lets you choose one or more examples to run.

  3. Open GettingStarted.cs and note that it:

    • Constructs a ReadByQuery instance that queries for vendors:

      ReadByQuery query = new ReadByQuery()
          ObjectName = "VENDOR",
          PageSize = 1, // Keep the count to just 1 for the example
          Fields =
    • Executes the query using the online client instance (client) that was instantiated in the bootstrap file:

      Task<OnlineResponse> task = client.Execute(query);
      OnlineResponse response = task.Result;
      Result result = response.Results[0];
      Console.WriteLine("Success! Number of vendor objects found: " + result.TotalCount);

Run the example

  1. Build and run the project, either from your IDE or the command line. For example, from the command line:

    cd Intacct.Examples
    "C:\Program Files\dotnet\dotnet.exe" build Intacct.Examples.csproj
    "C:\Program Files\dotnet\dotnet.exe" bin/Debug/netcoreapp2.0/Intacct.Examples.dll

    The console menu appears:

     Available examples:
     1 - Getting started
     2 - List vendors
     3 - CRUD customer
     4 - Custom object function
     5 - Exit program
  2. Type 1 to choose the example and press enter.

  3. Observe the output, for example:

    Success! Number of vendor objects found: 14
  4. Type 5 to exit the program.

  5. Open the generated Intacct.Examples/bin/Debug/netcoreapp2.0/logs/intacct.log file in a text editor and review the entries.

    The SDK provided one DEBUG entry for the HTTP request with the Sage Intacct endpoint (/ia/xml/xmlgw.phtml HTTP/1.1), and another for the single response. The response includes the request control ID, which defaults to the timestamp of the request, and the function control ID, which defaults to a random UUID.

Extra credit

Log level and format

  1. Edit the public static Client function in the Bootstrap class to change the SDK’s log message format and log level. This is done by adding LogLevel and LogMessageFormatter property setters:

    using Intacct.SDK.Logging; // add this line
    public static OnlineClient Client(ILogger logger)
        ClientConfig clientConfig = new ClientConfig()
            ProfileFile = Path.Combine(Directory.GetCurrentDirectory(), "credentials.ini"),
            Logger = logger,
            LogLevel = LogLevel.Info, // add this line
            LogMessageFormatter = new MessageFormatter("\"{method} {target} HTTP/{version}\" {code}"), // add this line
        OnlineClient client = new OnlineClient(clientConfig);
        return client;
  2. Run the project again, then open logs/intacct.log and review the new entries at the bottom. Note the response code is listed after the HTTP method in the second INFO block.

What’s next?

Provide feedback