Skip to content

Instantly share code, notes, and snippets.

View allenmichael's full-sized avatar

Allen-Michael Grobelny allenmichael

  • Amazon Web Services
  • Austin, TX
  • X @amsxbg
View GitHub Profile
using System;
using System.IO;
using System.Threading.Tasks;
using Box.V2.Config;
using Box.V2.JWTAuth;
namespace BoxGetAllUsers
{
class Program
{
package com.box;
import com.box.sdk.BoxConfig;
import com.box.sdk.BoxDeveloperEditionAPIConnection;
import com.box.sdk.BoxUser;
import java.io.BufferedReader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
'use strict';
const box = require('box-node-sdk');
const fs = require('fs');
const util = require('util');
let configFile = fs.readFileSync('config.json');
configFile = JSON.parse(configFile);
let session = box.getPreconfiguredInstance(configFile);
let serviceAccountClient = session.getAppAuthClient("enterprise");
'use strict';
// Require the Box SDK and the fs module
const box = require('box-node-sdk');
const fs = require('fs');
let configFile = fs.readFileSync('config.json');
configFile = JSON.parse(configFile);
// Initialize the SDK with the Box configuration file and create a client that uses the Service Account.
let session = box.getPreconfiguredInstance(configFile);
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using BoxOAuth.Models;
using Microsoft.Extensions.Options;
using Box.V2.Config;
using Box.V2;
cat private_key.pem | awk '{printf "%s\\n", $0}'
'use strict';
const box = require('box-node-sdk');
const fs = require('fs');
let configFile = fs.readFileSync('config.json');
configFile = JSON.parse(configFile);
let session = box.getPreconfiguredInstance(configFile);
let serviceAccountClient = session.getAppAuthClient('user');
serviceAccountClient.enterprise.addAppUser("Jonathan", { "external_app_user_id": "jonathan" })
rm -rf /usr/local/lib/boxcli && \
unlink /usr/local/bin/box
USER_ADMIN_ID="275111793" && \
USER_LOGIN="boxclidemo@gmail.com" && \
USER_NAME="Box Demo Account" && \
USER_FOLDER_NAME="$USER_LOGIN Welcome Folder" && \
USER_ID=$(box users create "$USER_NAME" $USER_LOGIN --id-only) && \
FOLDER_ID=$(box folders create 0 "$USER_FOLDER_NAME" --id-only) && \
FILE_ID=$(box files upload ~/Documents/Welcome.pptx -p $FOLDER_ID --id-only) && \
box folders collaborations add $FOLDER_ID --co-owner --login $USER_LOGIN && \
box folders collaborations add $FOLDER_ID --co-owner --user-id $USER_ADMIN_ID && \
box comments create $FILE_ID file --message "Welcome to your Box account! Just @ mention me if you have any questions." --as-user $USER_ADMIN_ID && \
@allenmichael
allenmichael / config.json
Created September 25, 2017 15:46
An example of the Box Application configuration file format
{
"boxAppSettings": {
"clientID": "",
"clientSecret": "",
"appAuth": {
"publicKeyID": "",
"privateKey": "",
"passphrase": ""
}
},