SharePoint Online - Download File

In this article

Overview

You can use this Snap to download the content of the primary stream (file) of an item. The Snap writes the binary stream to the output view.

Only driveItems with the file property can be downloaded. If the item to be downloaded is of type folder, the Snap will fail with an exception message “You cannot get content for a folder“.

Snap Type

SharePoint Online - Download File Snap is a Read-type Snap.

Prerequisites

  • Valid SharePoint Online tenant and associated site.

  • Valid Azure application with all the required API permissions.

Support for Ultra Pipelines

Works in Ultra Pipelines. However, we recommend that you not use this Snap in an Ultra Pipeline. To know the list of Snaps that work in Ultra and the related caveats, refer to Snap Support for Ultra Pipelines.

Limitations and Known Issues

None.

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Document

  • Min: 0

  • Max: 1

  • Filer Writer

  • CSV Parser

An input document contains the metadata of the item to be downloaded.



Output

Document

  • Min: 1

  • Max: 1

  • Mapper

  • JSON Formatter

An output binary document contains the downloaded item.

Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab:

  • Stop Pipeline Execution: Stops the current pipeline execution if the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the remaining records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap Settings

  • Asterisk (*): Indicates a mandatory field.

  • Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon (): Indicates that you can add fields in the field set.

  • Remove icon (): Indicates that you can remove fields from the field set.

Field Name

Field Type

Description

Field Name

Field Type

Description

Label*

 

Default Value: SharePoint Online - Download File
Example: SharePoint Online - Download File

String

Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.

Site*

 

Default Value: N/A
ExampleMySite

String/Expression

Specify the name of a site which contains the list of document library to be used in the subsequent Snap settings.

Custom Site Path

 

Default ValueDeselected

Checkbox

Enable this option if your site URL contains a custom path that deviates from the default site URL. Default site path always has the prefix ‘site/’ before the sitename, a custom site can contain the prefix ‘team/’ or it can have no prefix.

Document Library*

 

Default Value: N/A
ExampleShared Documents

String/Expression

Specify the a drive representing the top-level container for a file system, such as OneDrive or SharePoint document libraries. This field will be populated dynamically from different sites from the suggestion drop-down list. You can either choose a document library from suggestion drop-down list or enter the entity name manually.

If you enable the Site property as an expression, then the document library is not suggested, resulting in an exception.

Source item Relative Path*

 

Default Value: N/A
ExampletestFile.pdf

String/Expression

Specify the item resource path that represents a file, folder, or other item stored in a document library.

Connection details

Use this field set to specify connection properties to the SharePoint Online APIs. 

Connection Timeout*

 

Default Value30
Example40

Integer

Specify the connection timeout duration in seconds.

Number of Retries*

 

Default Value3
Example5

Integer

Specify the maximum number of reconnections in case of a connection failure or timeout.

Retry Interval (seconds)*

 

Default Value10
Example11

Integer

Specify the time interval in seconds between connection attempts.

Snap Execution

 

Default ValueValidate & Execute
ExampleExecute only

Dropdown list

Specify the required Pipeline execution type:

  • Validate & Execute. Performs limited execution of the Snap (up to 50 records) during Pipeline validation; performs full execution of the Snap (unlimited records) during Pipeline execution.

  • Execute only. Performs full execution of the Snap during Pipeline execution; does not execute the Snap during Pipeline validation.

  • Disabled. Disables the Snap and, by extension, its downstream Snaps.

Troubleshooting

Error

Reason

Resolution

Error

Reason

Resolution

HTTP Response Code:404

Entered item not found in the document library

Ensure to provide the valid item path to get the metadata.

Forbidden exception:403

Either user or app doesn't have sufficient permissions to read the metadata for the document library.

Ensure to provide the desired permissions both at the user and application level.

HTTP Response Code:404

You cannot get content for a folder

Ensure the file path have been provided in the source file path

Examples

Downloading a File

This example demonstrates how to download a file and store it in the SnapLogic database. The example assumes that you have configured & authorized a valid SharePoint Online Account. For more information, refer to SharePoint Online Account).

The following screenshot displays the settings of the SharePoint Online - Download File. The Snap specifies on how to download the content of the item of type file.

After successfully validating/executing the above Snap, the results displays in the following output preview.

Download this Pipeline.

Downloads

  File Modified

File Example_sharepoint_DownloadFile.slp

Mar 11, 2022 by Subhajit Sengupta

Snap Pack History