ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV, WEBDEV and WINDEV Mobile 2024 feature!
Help / WLanguage / WLanguage functions / Communication / Drive functions
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
Creates a connection to OneDrive.
Example
// ------------------------------------------
// OneDrive Personal login
//-------------------------------------------
oOAuth2Param is OAuth2Parameters
oOAuth2Param.ClientID = "client_id"
oOAuth2Param.ClientSecret = "client_secret"
oOAuth2Param.RedirectionURL = "http://localhost:9000/"
oDrive is Drive
oDrive = oDriveConnect(oOAuth2Param)
// ------------------------------------------
// OneDrive for Business login
//-------------------------------------------
// Connection parameter
OAuth2Param is OAuth2Parameters
OAuth2Param.ClientID = EDT_Client_ID
OAuth2Param.ClientSecret = EDT_Secret_code
// For a business account, please specify the tenant
    sTenant is string = "cb8c2ded-f328-4948-9f3d-b2efa5e59138"
    OAuth2Param.RedirectionURL = EDT_RedirectionURL
    OAuth2Param.AuthURL = "https://login.microsoftonline.com/[%sTenant%]/oauth2/v2.0/authorize"
    OAuth2Param.TokenURL = "https://login.microsoftonline.com/[%sTenant%]/oauth2/v2.0/token"
    OAuth2Param.Scope = "offline_access Files.ReadWrite.All"
    OAuth2Param.RedirectionURL = "http://localhost:3400/"
    authToken is AuthToken = AuthIdentify(OAuth2Param)
    IF ErrorOccurred THEN
         Error("Unable to log in", ErrorInfo())
          RETURN
      END
    // Log in to OneDrive
    gMyDrive = oDriveConnect(authToken)
<END>
IF ErrorOccurred THEN
Error("Unable to log in", ErrorInfo())
RETURN
END
Syntax

Authenticating to OneDrive using the OAuth 2.0 protocol Hide the details

<Result> = oDriveConnect(<Authentication parameters>)
<Result>: Drive variable
Drive variable that contains all the OneDrive connection information.
If an error occurs, the ErrorOccurred variable is set to True and an invalid variable is returned.
<Authentication parameters>: OAuth2Parameters variable
Name of the OAuth2Parameters variable that contains the authentication parameters:
  • The ClientID and ClientSecret properties must be specified.
  • The RedirectionURL property can be specified. By default, this property is set to "http://localhost:3400/".

Authenticating to OneDrive using a token (refresh token) Hide the details

<Result> = oDriveConnect(<Authentication parameters>)
<Result>: Drive variable
Drive variable that contains all the OneDrive connection information.
If an error occurs, the ErrorOccurred variable is set to True and an invalid variable is returned.
<Authentication parameters>: AuthToken variable
Name of the AuthToken variable that contains the authentication parameters.
Remarks
It is recommended to to pass a token with a refresh token so that users do not have to log in each time the application is launched. If necessary, the token will be automatically updated.
Information needed to connect to a drive using an existing token:
Properties of the OAuth2Parameters variableValue used by the oDriveConnect function
AuthURL"https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
TokenURL"https://login.microsoftonline.com/common/oauth2/v2.0/token"
Scope"offline_access Files.ReadWrite.All"
RedirectionURL (Editable)"http://localhost:3400/"
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).
Business / UI classification: Business Logic
Component: wd290ggl.dll
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