Hi, I'm experiencing the issue that uploading Pdf to the box by API by C#.
While uploading I am getting an unexpected error that Object reference not set to an instance of an object.
I Want just to upload a Pdf and get a Sharable Link with download and view.
Thank you very much.
----------------------------------------
Here is My Code
var config = new BoxConfigBuilder(<Client_Id>, <Client_Secret>, new Uri("https://developer.box.com/auth/callback")).Build();
var client = new BoxClient(config);
BoxFile newFile;
using (FileStream stream = new FileStream(@"C:\\Users\\Dhanraj Kumar\\Desktop\\Test.pdf", FileMode.Open))
{
BoxFileRequest req = new BoxFileRequest()
{
Name = "Test.pdf",
Parent = new BoxRequestEntity() { Id = "0" }
};
newFile = await client.FilesManager.UploadAsync(req, stream);
String Url = newFile.SharedLink.DownloadUrl;
}