File Sharing
The Shares API is universal for both modes and provides all the necessary methods for working with the Nextcloud Shares system.
- class nc_py_api.files.sharing._FilesSharingAPI(session: NcSessionBasic)[source]
Class provides all File Sharing functionality, avalaible as nc.files.sharing.<method>.
- property available: bool
Returns True if the Nextcloud instance supports this feature, False otherwise.
- get_list(shared_with_me=False, reshares=False, subfiles=False, path: str | FsNode = '') list[Share] [source]
Returns lists of shares.
- Parameters:
shared_with_me – Shares should be with the current user.
reshares – Only get shares by the current user and reshares.
subfiles – Only get all sub shares in a folder.
path – Get shares for a specific path.
- get_inherited(path: str) list[Share] [source]
Get all shares relative to a file, e.g., parent folders shares.
- create(path: str | FsNode, share_type: ShareType, permissions: FilePermissions | None = None, share_with: str = '', **kwargs) Share [source]
Creates a new share.
- Parameters:
path – The path of an existing file/directory.
share_type –
ShareType
value.permissions – combination of the
FilePermissions
values.share_with – the recipient of the shared object.
kwargs – See below.
Additionally supported arguments:
public_upload
- indicating should share be available for upload for non-registered users. default =False
password
- string with password to protect share. default =""
send_password_by_talk
- boolean indicating should password be automatically delivered using Talk. default =False
expire_date
-datetime
time when share should expire. hours, minutes, seconds are ignored. default =None
note
- string with note, if any. default =""
label
- string with label, if any. default =""
- update(share_id: int | Share, **kwargs) Share [source]
Updates the share options.
- Parameters:
share_id – ID of the Share to update.
kwargs – Available for update:
permissions
,password
,send_password_by_talk
,public_upload
,expire_date
,note
,label
.
Accept pending share.
Decline pending share.
Information about Share.
Unique ID of the share.
Type of the share.
To whom Share was created.
Recipient permissions.
URL at which Share is avalaible.
Share path relative to the user’s root directory.
Label for the Shared object.
Note for the Shared object.
Mimetype of the Shared object.
Share’s creator ID.
File/directory owner ID.
Password to access share.
Flag indicating was password send by Talk.
Share expiration time.
File source ID.
Does caller have
write
permissions.
Does caller have
delete
permissions.
Type of the object that will receive share.
Share to the user
Share to the group
Share by link
Share by the email
Share to the Federation
Share to the Nextcloud Circle
Share to Guest
Share to the Federation group
Share to the Talk room
Share to the Nextcloud Deck
Share to the Reva instance(Science Mesh)