ocs_create_share: Creates a share

View source: R/ocs.R

ocs_create_shareR Documentation

Creates a share

Description

Creates different share types:

Usage

ocs_create_share(
  req,
  path,
  share_type,
  share_with = NULL,
  password = NULL,
  permissions = 1,
  public_upload = FALSE,
  expire_date = NULL,
  label = "",
  note = "",
  send_mail = FALSE,
  attributes = NULL
)

ocs_create_share_link(
  req,
  path,
  password = NULL,
  permissions = 1,
  public_upload = FALSE,
  expire_date = NULL,
  note = "",
  label = ""
)

ocs_create_share_mail(
  req,
  path,
  email,
  password = NULL,
  permissions = 1,
  public_upload = FALSE,
  expire_date = NULL,
  note = "",
  label = "",
  send_mail = TRUE
)

ocs_create_share_user(
  req,
  path,
  user,
  permissions = 1,
  public_upload = FALSE,
  expire_date = NULL,
  note = "",
  label = "",
  send_mail = TRUE
)

ocs_create_share_group(
  req,
  path,
  group,
  permissions = 1,
  public_upload = FALSE,
  expire_date = NULL,
  note = "",
  label = "",
  send_mail = TRUE
)

ocs_create_share_federated(
  req,
  path,
  cloud_id,
  permissions = 1,
  public_upload = FALSE,
  expire_date = NULL,
  note = "",
  label = "",
  send_mail = TRUE
)

Arguments

req

WebDAV request as returned by wd_connect

path

folder or file path

share_type

integer 0:user, 1:group, 3:link, 4:e-mail, 6:federated

share_with

depending on share type: user id, group id, e-mail address or federated cloud id (only for ocs_create_share)

password

optional password for link and e-mail shares

permissions

integer (1:read, 2:modify, 4:, 8:, 16:share)

public_upload

TRUE if public upload should be enabled

expire_date

expiration date as string in the format YYYY-MM-DD

label

label for the share

note

note for the share

send_mail

if TRUE the user is notified via e-mail

attributes

optional attributes

email

e-mail address (only for ocs_create_share_mail)

user

id of the user (only for ocs_create_share_user)

group

id of the group (only for ocs_create_share_group)

cloud_id

cloud id (only for ocs_create_share_federated)

Details

  • ocs_create_share - generic method that takes share type as argument

  • ocs_create_share_user - creates a share for a nextcloud user

  • ocs_create_share_group - creates a share for a nextcloud group

  • ocs_create_share_link - create a public share link

  • ocs_create_share_mail - creates an e-mail share

  • ocs_create_share_federated - creates a federated share

Notice: if protecting a public link or e-mail share with a password, make sure that the password meets the services' password policy.

Value

information for the newly created share as data.frame

Examples

## Not run: 
r <- wd_connect("https://example.com/remote.php/dav/files/johndoe")
ocs_create_share(r, "myfolder/share", 4)
ocs_create_share_link(r, "myfolder/share")
ocs_create_share_mail(r, "myfolder/share", "jack@example.com")
ocs_create_share_user(r, "myfolder/share", "jackdoe")


## End(Not run)


rdav documentation built on Nov. 1, 2025, 3:01 a.m.