Coder Social home page Coder Social logo

jeffpignataro / smartsheet-csharp-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smartsheet-platform/smartsheet-csharp-sdk

0.0 1.0 0.0 16.64 MB

Library that uses C# to connect to Smartsheet services.

License: Apache License 2.0

Shell 0.05% C# 99.88% Batchfile 0.07%

smartsheet-csharp-sdk's Introduction

Smartsheet SDK for C# NuGet

This is a C# SDK to simplify connecting to the Smartsheet API from .NET applications.

System Requirements

The SDK supports C# version 4.0 or later running on .NET platform version 4.5.2 or later. In addition, we support any .NET language compatible with that platform version.

Installation

The SDK can be installed by using NuGet or by compiling from source. These two alternatives are outlined below.

Install with NuGet

If unfamiliar with NuGet, please take a look at the NuGet documentation.

To install the SDK in Visual Studio, right click the References for the project and select Manage NuGet Packages.

Select the Browse or Online tab (depending upon the version of Visual Studio) then type smartsheet in the search box. Select smartsheet-csharp-sdk in the search results and click the Install button.

After clicking Install, you will be asked to accept the License (Apache). Then it will install the Smartsheet SDK and the dependencies (RestSharp, Newtonsoft.Json, and NLog) by adding these libraries to the References section of the project.

You can also use the following command in the Package Manager Console to install the SDK:

Install-Package smartsheet-csharp-sdk

Compile From Source

You can download and compile the source code for the SDK from Github. Use git to fetch it and use Visual Studio or a program such as MSBuild to build it.

In Visual Studio you can open the entire solution with the file Smartsheet-csharp-sdk.sln, or open the specific project Smartsheet-csharp-sdk.csproj.

You can also do this via the command line with the following three commands. Note: The path to msbuild may vary.

git clone https://github.com/smartsheet-platform/smartsheet-csharp-sdk.git
cd smartsheet-csharp-sdk
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild smartsheet-csharp-sdk.sln /property:Configuration=release /t:rebuild

Example Usage

To call the API, you will need an access token, which looks something like this example: ll352u9jujauoqz4gstvsae05. You can find the access token in the UI at Account > Personal Settings > API Access.

The following is a brief sample that shows you how to:

  • Initialize the client
  • List all sheets
  • Load one sheet
using Smartsheet.Api;
using Smartsheet.Api.Models;

static void Sample()
{
    // Initialize client
    SmartsheetClient smartsheet = new SmartsheetBuilder()
        // TODO: Set your API access in environment variable SMARTSHEET_ACCESS_TOKEN or else here
        // .SetAccessToken("ll352u9jujauoqz4gstvsae05")
        .Build();

    // List all sheets
    PaginatedResult<Sheet> sheets = smartsheet.SheetResources.ListSheets(
        null,               // IEnumerable<SheetInclusion> includes
        null,               // PaginationParameters
        null                // Nullable<DateTime> modifiedSince = null
    );
    Console.WriteLine("Found " + sheets.TotalCount + " sheets");

    long sheetId = (long) sheets.Data[0].Id;                // Default to first sheet

    // sheetId = 567034672138842;                         // TODO: Uncomment if you wish to read a specific sheet

    Console.WriteLine("Loading sheet id: " + sheetId);

    // Load the entire sheet
    var sheet = smartsheet.SheetResources.GetSheet(
        5670346721388420,           // long sheetId
        null,                       // IEnumerable<SheetLevelInclusion> includes
        null,                       // IEnumerable<SheetLevelExclusion> excludes
        null,                       // IEnumerable<long> rowIds
        null,                       // IEnumerable<int> rowNumbers
        null,                       // IEnumerable<long> columnIds
        null,                       // Nullable<long> pageSize
        null                        // Nullable<long> page
    );
    Console.WriteLine("Loaded " + sheet.Rows.Count + " rows from sheet: " + sheet.Name);
}

A simple, but complete sample application project is here: https://github.com/smartsheet-samples/csharp-read-write-sheet

Advanced Topics

For details about logging, testing, how to use a passthrough option, and how to override HTTP client behavior, see Advanced Topics.

Documentation

The full Smartsheet API documentation is here: http://smartsheet-platform.github.io/api-docs/?csharp#.

The generated SDK class documentation is here: http://smartsheet-platform.github.io/smartsheet-csharp-sdk/.

Contributing

If you would like to contribute a change to the SDK, please fork a branch and then submit a pull request. More info here.

Support

If you have any questions or issues with this SDK please post on StackOverflow using the tag "smartsheet-api" or contact us directly at [email protected].

Release Notes

All releases and release notes are available on Github or the NuGet repository.

smartsheet-csharp-sdk's People

Contributors

activescott avatar bogdansireteanu avatar brentaiipllc avatar brettbatie avatar cameronbowie avatar coxito avatar ericspaghetti avatar gpltaylor avatar jtp3xp avatar kbrandl avatar kfansler avatar orthographic-pedant avatar seweil avatar stollgr avatar timwellswa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.