PLATFORMS SOLUTIONS BLOGS CONTACT

OneDrive Adapter



Provides access to OneDrive (Personal) drives and files using SQL Server and REST commands.


This adapter requires advanced configuration with Azure AD and OAuth Configuration


OAuth Configuration

This adapter requires Azure AD and OAuth to be configured.

show steps 
  • Register an Application in Azure AD
    Register an application with Microsoft Azure Directory using the Azure Portal (choose App Registrations, and select New Registration, and select Associate with Personal Account) https://portal.azure.com. Enter the Web redirect URL to https://localhost.
  • Create an Application Secret
    Locate the Application ID, Directory ID (Tenant ID), and create a new Application Secret (found under Certificates and Secrets). Copy the Secret in memory (this secret is only available when it is first created).

    NOTE: If your login is used for both OneDrive and OneDrive for Business, you may need to update the Manifest of the application to use AzureADandPersonalMicrosoftAccount for the signInAudience setting.
  • Assign all necessary rights
    Select API Permissions for this application, and click Add Permissions (choose Microsoft Graph) and add the following Microsoft Graph permissions: Files.ReadAll, Files.WriteAll, Files.Read, Files.Write and offline_access.
  • In Enzo Manager, create a Config Setting
    Create a new Configuration Setting for OneDrive and save the secrets obtained above, along with the Tenant ID.
  • Get the OAuth URL, and go through the authentication flow
    Start SQL Server Management Studio, connect to Enzo directly, and execute the GetAuthURL handler. Copy and paste the URL provided, and go through the authentication flow. You will receive an error page saying 'This site can't be reached'; this is normal. Copy URL found in the URL bar (starting with https://localhost).
  • Execute the GetToken handler and pass the URL above as an argument.
    This call will return two values: AccessToken and RefreshToken.
  • Update the Config Setting
    Update the Config Settings with the above tokens.


Configuration Settings



Name Description Default
Boolean _isDefault Make this the default configuration. Defaults to true if configName is already the default.
String appId appId used for authentication
String clientSecret clientSecret used for authentication
String accessToken The accessToken used for authentication
String refreshToken The refreshToken used for authentication of OneDrive api when expire accessToken

Handlers



createFolder
folders
Create new folder details 

Arguments

Name Description Default
folderName R
parentFolder

SQL Call

EXEC OneDrive.createFolder @folderName='Test Folder'
INSERT INTO OneDrive.folders (folderName) VALUES ('test')


Http Call

/bsc/onedrive/createfolder

Output Columns

This call does not return data.

deleteFile
files
Delete a file details 

Arguments

Name Description Default
fileId R

SQL Call

EXEC OneDrive.deleteFile  @fileId='fileid'
Delete from OneDrive.files where fileId='fileid'


Http Call

/bsc/onedrive/deletefile

Output Columns

This call does not return data.

deleteFolder
folders
Delete a folder details 

Arguments

Name Description Default
fileId R

SQL Call

EXEC OneDrive.deleteFolder @fileId='fileId'
Delete from OneDrive.folders where fileId='fileid'


Http Call

/bsc/onedrive/deletefolder

Output Columns

This call does not return data.

downloadFile
file
Download a file to a local or UNC path details 

Arguments

Name Description Default
id R
downloadPath
override False
timeout 0
retryCount 3

SQL Call

EXEC OneDrive.downloadFile @id='fileId',@downloadPath='D:\download'


Http Call

/bsc/onedrive/downloadfile

Output Columns

String fileName
String tmpFileName
Int64 byteTx
Double elapsedTime
String id
String downloadPath
Boolean override
Int32 timeout
Int32 retryCount
GetAuthUrl
Get Auth Url details 

Arguments


SQL Call

exec OneDrive.GetAuthUrl


Http Call

/bsc/onedrive/getauthurl

Output Columns

String Url
GetToken
Get access token details 

Arguments

Name Description Default
responseCode

SQL Call

exec OneDrive.GetToken 'responsecodeurl'


Http Call

/bsc/onedrive/gettoken

Output Columns

String code
String tokenType
Double expiresIn
String scope
String accessToken
String refreshToken
listFiles
files
Returns the list of files/folders details 

Arguments

Name Description Default
path
fileName
topn

SQL Call

exec OneDrive.listFiles
SELECT * FROM OneDrive.files


Http Call

/bsc/onedrive/listfiles

Output Columns

String id
String name
String webUrl
String size
String createdBy
DateTime createdDateTime
String lastModifiedBy
DateTime lastModifiedDateTime
Boolean isFolder
String path
RefreshToken
Forces the creation of a new access token for the current logged in user details 

Arguments

Name Description Default
refreshToken

SQL Call

exec OneDrive.RefreshToken 


Http Call

/bsc/onedrive/refreshtoken

Output Columns

String tokenType
Double expires_in
String scope
String accessToken
String refreshToken
renameFile
files
Rename an existing file details 

Arguments

Name Description Default
fileName R
id R

SQL Call

EXEC OneDrive.renameFile @fileName='testFile.doc',@id='fileId'
update OneDrive.folders set fileName='testFile.doc' where id='fileid'


Http Call

/bsc/onedrive/renamefile

Output Columns

This call does not return data.

renameFolder
folders
Rename an existing folder details 

Arguments

Name Description Default
fileName R
id R

SQL Call

EXEC OneDrive.renameFolder @fileName='test folder',@id='folderid'
update OneDrive.folders set fileName='test rename' where id='id'


Http Call

/bsc/onedrive/renamefolder

Output Columns

This call does not return data.

uploadFile
file
Upload a file to OneDrive details 

Arguments

Name Description Default
sourceFile R
fileName R
override False
timeout 0

SQL Call

EXEC OneDrive.uploadFile  @id='folderid',@sourceFile='D:\Download\A100.pdf',@fileName='A100.pdf'


Http Call

/bsc/onedrive/uploadfile

Output Columns

This call does not return data.








601 21st St Suite 300
Vero Beach, FL 32960
United States

(561) 921-8669
info@enzounified.com
terms of service
privacy policy

PLATFORM

ENZO SERVER
ENZO DATAZEN

SOLUTIONS

SOLUTIONS OVERVIEW
INTEGRATION
SaaS
CLOUD ANALYTICS

RESOURCES

DOWNLOAD
BLOGS & VIDEOS
IN THE NEWS
ENZO ADAPTERS
ONLINE DOCUMENTATION
TCO CALCULATOR

COMPANY

LEADERSHIP TEAM
PARTNERS


© 2023 - Enzo Unified