Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Interacting with file entities

Updated on March 15, 2022

Make use of the file entity data pages to interact with your SharePoint files directly from your Pega application. In addition to retrieving information about specific files, you can use these data pages to create and delete files. Moreover, you can check files in or out, as well as update their content.

Adding a hosted file to a list or library

When referenced, the D_SPOnlineAddTemplateFile data page posts information to add a hosted file to an existing SharePoint list or document library.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineAddTemplateFileInt-SPO-Filehttps://<site_url>/_api/web/GetFolderByServerRelativeUrl('<FolderPath'>)/files/addTemplateFile(urloffile='TemplateFilePath',templatefiletype=TemplateFileType)POST

Data page parameters

NameDescriptionRequired
FolderPathSpecifies the folder path.

For example, Documents/Test.

TemplateFileNameSpecifies the name of the template file along with the corresponding file extension.

For example, contacts.txt.

TemplateFileTypeSpecifies the file template type.
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.

Creating a file

When referenced, the D_SPOnlineCreateFile data page posts information to create a file and add it to an existing folder.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineCreateFilePega-API-Storage-Filehttps://<site_url>/_api/web/GetFolderByServerRelativeUrl('FolderPath')/Files/add(url='FileName',overwrite=true)POST

Data page parameters

NameDescriptionRequired
FolderPathSpecifies the folder path.

For example, Documents/Test.

FileNameSpecifies the file name for which you want to perform this operation.
FileContentSpecifies the content of the file in the Base64 encoded format.
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.

Deleting a file

When referenced, the D_SPOnlineDeleteFile data page posts information to delete an existing file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineDeleteFilePega-API-Storage-Filehttps://<site_url>/_api/web/GetFileByServerRelativeUrl('FilePath')

With the Recycle parameter set to true:

POST

Data page parameters

NameDescriptionRequired
FilePathSpecifies the file path.

For example, Documents/Test/contacts.txt.

RecycleSpecifies whether to move the file to the recycle bin.
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
IfMatchHeaderSpecifies a valid ETag value to use during the operation. The default value is *.

Checking in a file

When referenced, the D_SPOnlineFileCheckIn data page attempts to check in a checked-out file. The data page uses CheckinComments/CheckinType to version the file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineFileCheckInInt-SPO-FileCheckinhttps://{site url}/_api/web/GetFileByServerRelativeUrl (‘<file path>’)/checkinPUT

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FilePathSpecifies the file path.

For example, Documents/Test/contacts.txt.

CheckinCommentsSpecifies the file check-in comments.
CheckInTypeSpecifies one of the following check-in types: MinorCheckIn = 0; MajorCheckIn = 1; OverwriteCheckIn = 2.

Checking out a file

When referenced, the D_SPOnlineFileCheckout data page posts information to check out a single file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineFileCheckoutInt-SPO-FileCheckouthttps://{site url}/_api/web/GetFileByServerRelativeUrl (‘<file path>’)/checkoutPOST

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FilePathSpecifies the file path.

For example, Documents/Test/contacts.txt.

Retrieving file content

When referenced, the D_SPOnlineGetFileContent data page returns the content of a single file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineGetFileContentPega-API-Storage-Filehttps://{site url}/_api/web/ GetFileByServerRelativeUrl (‘<file path>’)/ $valueGET

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FilePathSpecifies the file path.

For example, Documents/Test/contacts.txt.

VersionSpecifies the version of the file in the MajorVersion.MinorVersion format.

For example, 2.15.

Note: To retrieve the content of the current (highest) version, do not specify any value.

Retrieving a list of files

When referenced, the D_SPOnlineGetFileContent data page returns a list of files from a single folder.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineGetFilesInt-SPO-ListFileshttps://{site url}/_api/web/ GetFolderByServerRelativeUrl (‘<folder path>’)/filesGET

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FilePathSpecifies the file path.

For example, Documents/Test/contacts.txt.

SelectFieldsSpecifies the fields to retrieve.
SelectItemsSpecifies the items to retrieve. You can use this filter to return results that match a simple logical expression.

For example, in an ID eq 2 expression, ID is the field name, eq is the equality operator, and 2 is the matching value.

For more information about the supported operators and query options, refer to the SharePoint documentation.

OrderBySpecifies the sorting (by field) and order (ascending or descending) in which the results are displayed.

For example, you can display the results sorted by title in a descending order, by specifying Title Desc for this parameter.

TopNItemsRetrieves the top n (integer value) results.
SkipUntilSkips over items until the specified item is reached, and then returns the rest.

For example, if you sort by title in a descending order and configure the data page to skip titles until K, the call retrieves all titles that start with the letters from the K to A range.

Retrieving the versioning history of a file

When referenced, the D_SPOnlineGetFileVersions data page returns information about the version and history of a single file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineGetFileVersionsInt-SPO-FileVersionshttps://{site url}/_api/web/ GetFileByServerRelativeUrl (‘<file path>’)/ versionsPOST

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FilePathSpecifies the file path.

For example, Documents/Test/contacts.txt.

Retrieving the current version and metadata of a file

When referenced, the D_SPOnlineGetFileCurrentVersion data page returns metadata and the current version of a single file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineGetFileCurrentVersionInt-SPO-CurrentFileVersionhttps://{site url}/_api/web/ getfilebyserverrelativeurl (‘<file path>’)/ ?$select=FileLeafRef,UiVersionLabelGET

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FilePathSpecifies the file path.

For example, Documents/Test/contacts.txt.

Updating file content

When referenced, the D_SPOnlineUpdateFileContent data page posts information to update the content of an existing file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineUpdateFileContentInt-SPO-UpdateFileContenthttps://{site url}/_api/web/ GetFileByServerRelativeUrl (‘<file path>’)/ $valuePOST

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FilePathSpecifies the file path.

For example, Documents/Test/contacts.txt.

FileContentSpecifies the content of the file in the Base64 encoded format.

Retrieving file metadata

When referenced, the D_SPOnlineGetFileMetadata data page returns metadata for a single file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineGetFileMetadataInt-SPO-FileMetadatahttps://{site url}/_api/Web/getFileByServerRelativeUrl('<file path>')/listItemAllFieldsGET

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FolderPathSpecifies the folder path.

For example, Documents/Test.

FileNameSpecifies the file name for which you want to perform this operation.

Updating file title

When referenced, the D_SPOnlineUpdateFileTitle data page posts information to update the title of an existing file.

Data page details

Data pageData typeSharePoint APIHTTP method
D_SPOnlineUpdateFileTitleInt-SPO-UpdateFileTitlehttps://{site url}/_api/Web/Lists(guid'Folder Id as List')/Items(<File ID as List Item>)POST

Data page parameters

NameDescriptionRequired
SiteNameOverrides the default site in SPOnlineSetings.
AuthProfileOverrides the default authentication profile in the SPOnlineSetings data transform.
FolderPathSpecifies the folder path.

For example, Documents/Test.

FileNameSpecifies the file name for which you want to perform this operation.
FileTitleSpecifies the new title for the file that you want to update.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us