Skip to content

Instantly share code, notes, and snippets.

View cburnette's full-sized avatar

Chad Burnette cburnette

View GitHub Profile
<add key="boxClientId" value="59oj4w7tft85e3t43v1dk4fbqub2e7bo" />
<add key="boxClientSecret" value="MdSMRvyNNBkTAYZmFTgPXJuVfxf2af5s" />
<add key="boxEnterpriseId" value="653871" />
<add key="boxPrivateKeyPassword" value="BoxTraining1234" />
<add key="boxPublicKeyId" value="eq2emlah" />
using Box.V2;
using Box.V2.Auth;
using Box.V2.Config;
using Box.V2.JWTAuth;
using Box.V2.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
namespace BasicMvcSample.Helpers
{
public static class CacheHelper
{
// The Box Auth Header. Add your access token.
var headers = { Authorization: 'Bearer @ViewBag.AccessToken'};
var uploadUrl = 'https://upload.box.com/api/2.0/files/content';
var files = fileSelect.files;
var formData = new FormData();
formData.append('files', files[0], files[0].name);
// Add the destination folder for the upload to the form
public async Task<FileStreamResult> Thumbnail(string id)
{
var thumbBytes = await BoxHelper.UserClient().FilesManager.GetThumbnailAsync(id, minHeight: 256, minWidth: 256, maxHeight: 256, maxWidth: 256);
return new FileStreamResult(thumbBytes, "image/png");
}