BoxConfigBuilder class does not exist in Box.V2.Config namespace
matttrakker opened this issue · comments
The issue is named a month ago in the comminity forum, link
Description of the Issue
I'd like to build an app that uploads files via the api. Right now I just want to copy and adjust the examples which are in the repo.
This is failing due to two unresolved objects, BoxConfigBuilder
& BoxClient
, so the project cannot be build.
Steps to Reproduce
- open visual studio 2019
- create a console app, c# target .net core 3.1
- add the nuget package Box.V2.Core 3.26.0
- copy the following code in the program.cs
- and try to compile the program
-
- the error is not possible because of "missing assembly error"
using System;
using System.IO;
using System.Threading.Tasks;
using Box.V2.Config;
using Box.V2.Models;
using Box.V2.Auth;
using System.Diagnostics;
using Box.V2.Utility;
namespace BoxUpload
{
public class Program
{
private static void Main(string[] args)
{
try
{
new Program().ExecuteMainAsync().Wait();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
private async Task ExecuteMainAsync()
{
Console.WriteLine("Access token: ");
var accessToken = Console.ReadLine();
Console.WriteLine("Remote file name: ");
var fileName = Console.ReadLine();
Console.WriteLine("Local file path: ");
var localFilePath = Console.ReadLine();
Console.WriteLine("Parent folder Id: ");
var parentFolderId = Console.ReadLine();
var timer = Stopwatch.StartNew();
var auth = new OAuthSession(accessToken, "YOUR_REFRESH_TOKEN", 3600, "bearer");
var config = new BoxConfigBuilder("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", new Uri("http://boxsdk"))
.Build();
var client = new BoxClient(config, auth);
var file = File.OpenRead(localFilePath);
var fileRequest = new BoxFileRequest
{
Name = fileName,
Parent = new BoxFolderRequest { Id = parentFolderId }
};
// Normal file upload
// var bFile = await client.FilesManager.UploadAsync(fileRequest, file);
// Supercharged filed upload with progress report, only works with file >= 50m.
var progress = new Progress<BoxProgress>(val => { Console.WriteLine("{0}%", val.progress); });
var bFile = await client.FilesManager.UploadUsingSessionAsync(file, fileName, parentFolderId, null, progress);
Console.WriteLine("{0} uploaded to folder: {1} as file: {2}", localFilePath, parentFolderId, bFile.Id);
Console.WriteLine("Time spend : {0} ms", timer.ElapsedMilliseconds);
}
}
}
Expected Behavior
program could be compiled
Error Message, Including Stack Trace
The following errors are existing:
- Error CS0246 The type or namespace name 'BoxConfigBuilder' could not be found (are you missing a using directive or an assembly reference?)
- Error CS0246 The type or namespace name 'BoxClient' could not be found (are you missing a using directive or an assembly reference?)
Versions Used
Windows 10 Version 10.0.19041 Build 19041 (VM)
Visual Studio 2019 Enterprise
.Net Core 3.1
Nuget Box.V2.Core 3.26.0
Hope that's all information needed :)
Hi @matttrakker
The SDK version with BoxConfigBuilder
was not actually released yet. I'll revert changes in the documentation to reflect released code. Please use BoxConfig
instead. Sorry for the inconvenience.
Thanks