(CkPython) OneDrive -- Download to File
Downloads the contents of a DriveItem directly to a file in the local filesystem.
Note: This example requires Chilkat v or greater.
import sys import chilkat # This example requires the Chilkat API to have been previously unlocked.# See Global Unlock Sample for sample code. http = www.cronistalascolonias.com.ar() # Use your previously obtained access token here:# See the following examples for getting an access token:# Get Microsoft Graph OAuth2 Access Token (Azure AD v Endpoint).# Get Microsoft Graph OAuth2 Access Token (Azure AD Endpoint).# Refresh Access Token (Azure AD v Endpoint).# Refresh Access Token (Azure AD Endpoint).# (Make sure your token was obtained with the FilesRead or www.cronistalascolonias.com.arite scope.) www.cronistalascolonias.com.ar_AuthToken("MICROSOFT_GRAPH_ACCESS_TOKEN") # Sends the following GET request:# GET www.cronistalascolonias.com.ar:/{item-path}:/content# Make sure to automatically follow redirects www.cronistalascolonias.com.ar_FollowRedirects(True) # This example will download /Misc/wildlife/www.cronistalascolonias.com.ar www.cronistalascolonias.com.arVar("item_path","Misc/wildlife/www.cronistalascolonias.com.ar") # Stream the response body directly to a local file. localPath = "qa_output/www.cronistalascolonias.com.ar" success = www.cronistalascolonias.com.arad("www.cronistalascolonias.com.ar:/{$item_path}:/content",localPath) if (www.cronistalascolonias.com.ar_LastMethodSuccess() != True): print(www.cronistalascolonias.com.arrorText()) www.cronistalascolonias.com.ar() # If the response status code was not , then it www.cronistalascolonias.com.ar (www.cronistalascolonias.com.ar_LastStatus() != ): print("Response Status Code = " + str(www.cronistalascolonias.com.ar_LastStatus())) print("Failed.") www.cronistalascolonias.com.ar() # If we got here, then the file was successfully www.cronistalascolonias.com.ar("Download from OneDrive successful.")
-