Sharepoint¶
flowtask.interfaces.Sharepoint
¶
SharepointClient
¶
Bases: O365Client
Sharepoint Client.
Managing connections to MS Sharepoint Resources.
create_subscription
async
¶
Create a webhook subscription to receive notifications when files are added, updated, or deleted in a SharePoint document library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
library_id
|
str
|
The ID of the SharePoint document library to subscribe to. |
required |
webhook_url
|
str
|
The webhook URL to receive notifications. |
required |
client_state
|
str
|
A secret string to verify notifications. |
'secret_string'
|
expiration_days
|
int
|
Duration in days for the subscription to be valid (maximum is 180 days). |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The response from Microsoft Graph API containing the subscription details. |
download_files
async
¶
Download a list of files from SharePoint to a specified destination directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
List[dict]
|
A list of dictionaries with 'directory' and 'filename' keys. |
required |
destination_dir
|
str
|
The local directory where files will be downloaded. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
List |
List
|
A list of paths to the downloaded files. |
get_library_id
¶
Extracts the Library ID of a SharePoint document library from an absolute URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
absolute_url
|
str
|
The absolute URL of the SharePoint resource. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The ID of the document library. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the library ID could not be retrieved. |
upload_files
async
¶
Upload files to a SharePoint folder using a resumable upload for large files.