ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV, WEBDEV and WINDEV Mobile 2024 feature!
Help / WLanguage / WLanguage functions / Communication / Drive functions
  • Authenticating to a drive using an OAuth2Parameters variable (recommended)
  • Authenticating to a drive using an AuthToken variable
  • Functions that use Drive variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The Drive type is used to handle online storage services. To use a Drive variable, you need to connect to the desired service using one of the following functions:
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
oOAuth2Param is OAuth2Parameters
oOAuth2Param.ClientID = "client_id"
oOAuth2Param.ClientSecret = "client_secret"
oOAuth2Param.RedirectionURL = "http://localhost:9000/"

oDrive is Drive
oDrive = oDriveConnect(oOAuth2Param) // OneDrive
oMyOAuthParameters is OAuth2Parameters

// Initialize API authentication parameters
oOAuth2Token is AuthToken
oOAuth2Token = AuthIdentify(oMyOAuthParameters)

oDrive is Drive

// Use one of the following functions depending on the API:
oDrive = GglDriveConnect(oOAuth2Token) // GoogleDrive
oDrive = oDriveConnect(oOAuth2Token) // OneDrive
oDrive = dpDriveConnect(oOAuth2Token) // Dropbox
Remarks

Authenticating to a drive using an OAuth2Parameters variable (recommended)

To connect to a drive using the OAuth 2.0 standard, you need to:
  1. Declare a variable of type OAuth2Parameters.
  2. Specify the ClientID and ClientSecret properties. These properties are mandatory.
    The key and secret code are provided when you create a Google application. These details can also be found in the drive developer console.
  3. Specify the RedirectionURL property (optional but recommended). The redirection URL ('redirect_uri', 'callback URL' or 'site URL') depends on the value specified in the application settings defined on the service provider's website. The URL must exist and the values must match.
  4. Declare a Drive variable.
  5. Use one of the functions to connect to the desired storage service. The OAuth2Parameters variable is then passed as a parameter to the connection function.
Example:
oOAuth2Param is OAuth2Parameters
oOAuth2Param.ClientID = "client_id"
oOAuth2Param.ClientSecret = "client_secret"
oOAuth2Param.RedirectionURL = "http://localhost:9000/"

oDrive is Drive
// Connect to Google Drive
oDrive = GglDriveConnect(oOAuth2Param)

Authenticating to a drive using an AuthToken variable

If your application uses several services from the same provider (mail, drive, etc.), it may be advisable to keep the same tokens for all services. In this case, you can use an AuthToken variable.
To connect to a drive using an AuthToken variable, you need to:
  1. Declare a variable of type OAuth2Parameters. This variable contains all the information needed to authenticate to a service that uses OAuth 2.0.
  2. Declare a variable of type AuthToken and initialize it with AuthIdentify.
  3. Declare a Drive variable.
  4. Use one of the functions to connect to the desired storage service. The AuthToken variable is then passed as a parameter to the connection function.
Example:
oMyOAuthParameters is OAuth2Parameters
// Initialize authentication parameters
oOAuth2Token is AuthToken
oOAuth2Token = AuthIdentify(oMyOAuthParameters)

oDrive is Drive
// Connect to Google Drive
oDrive = GglDriveConnect(oOAuth2Token)

Functions that use Drive variables

The following functions are used to handle Drive variables:
New in version 2024
dpDriveConnect
Creates a connection to Dropbox.
New in version 2024
DriveCopyDirectory
Copies a directory on a remote drive to another directory.
New in version 2024
DriveCopyFile
Copies a single file on a remote drive to another directory on same drive.
New in version 2024
DriveCreateDirectory
Creates a directory on the remote drive.
New in version 2024
DriveCreateFile
Creates a file on the remote drive.
New in version 2024
DriveDeleteDirectory
Deletes a directory and its files from a remote drive.
New in version 2024
DriveDeleteFile
Deletes a file from a remote drive.
New in version 2024
DriveDownloadDirectory
Downloads a directory and its files from a remote drive to the user's computer.
New in version 2024
DriveDownloadFile
Downloads a file from a remote drive to the user's computer.
New in version 2024
DriveListDirectory
Lists drive directories.
New in version 2024
DriveListFile
Lists the files in a cloud-based drive directory.
New in version 2024
DriveMoveDirectory
Moves a directory and its contents to another directory within a remote drive.
New in version 2024
DriveMoveFile
Moves a file on a remote drive from one directory to another.
New in version 2024
DriveRename
Renames a file or directory on a remote drive.
New in version 2024
DriveUploadDirectory
Uploads a directory and its contents to a remote drive.
New in version 2024
DriveUploadFile
Uploads a local file to a remote drive.
New in version 2024
GglDriveConnect
Creates a connection to Google Drive.
New in version 2024
oDriveConnect
Creates a connection to OneDrive.
Related Examples:
Drive functions Unit examples (WINDEV): Drive functions
[ + ] This example illustrates the use of Drive functions (Google Drive, Dropbox, OneDrive).
Drive functions Unit examples (WINDEV Mobile): Drive functions
[ + ] This example illustrates the use of Drive functions (Google Drive, Dropbox, OneDrive).
Minimum version required
  • Version 2024
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/05/2024

Send a report | Local help