项目作者: adciechomski

项目描述 :
VBA to upload file using Box API by calling VSTO dll
高级语言: C#
项目地址: git://github.com/adciechomski/VSTOBoxUploadDLLSample.git
创建时间: 2017-12-29T06:06:23Z
项目社区:https://github.com/adciechomski/VSTOBoxUploadDLLSample

开源协议:

下载


BoxUpload

This solution is only for BOX API testing purposes, download it and open with Visual Studio. you can deploy it as VSTO and use as dll COM and do calls from VBA which is one of the methods of customizing BOX API in Office.

onOpened xls instance by VS, press Alt+F11 add new module and paste code to the module:

  1. '###############################
  2. Sub VSTOcall()
  3. Dim addIn As COMAddIn
  4. Dim classObj As Object
  5. Set addIn = Application.COMAddIns("BoxUpload")
  6. Set classObj = addIn.Object
  7. classObj.uploadFile "0", [accessToken], "C:\Users\username\OneDrive\Documents\", "test.txt"
  8. End Sub
  9. '###############################

To use uploadFile feature in VBA use exposed method:
void uploadFile(string folderId, string accessToken, string filePath, string fileName);

folderId = 0 [main box.com user folder]
accessToken [login into box.com for developers portal -> create app -> generate DevToken from application dashboard -> paste as accessToken]
filePath [path to folder with file to be uploaded]
fileName [file + extension to be uploaded in given filePath folder] [example.txt]