Share

class OCP\Share
This class provides the ability for apps to share their content between users.
Apps must create a backend class that implements OCP\Share_Backend and register it with this class.

It provides the following hooks:
- post_shared
Source:lib/public/Share.php#48
Parent:OC\Share\Constants

Methods

public static OCP\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner=null)
Get the item of item type shared with a given user by source
Source:

lib/public/Share.php#60

Parameters:
  • $itemType (string)
  • $itemSource (string)
  • $user (string) User to whom the item was shared
  • $owner (string) Owner of the share
Returns:

array Return list of items with file_target, permissions and expiration

Since:

6.0.0 - parameter $owner was added in 8.0.0

Deprecated:

17.0.0

public static OCP\Share::getItemSharedWithBySource($itemType, $itemSource, $format=self::FORMAT_NONE, $parameters=null, $includeCollections=false)
Get the item of item type shared with the current user by source
Source:

lib/public/Share.php#75

Parameters:
  • $itemType (string)
  • $itemSource (string)
  • $format (int) (optional) Format type must be defined by the backend
  • $parameters (mixed)
  • $includeCollections (bool)
Returns:

array

Since:

5.0.0

Deprecated:

17.0.0

public static OCP\Share::getShareByToken($token, $checkPasswordProtection=true)
Based on the given token the share information will be returned - password protected shares will be verified
Source:

lib/public/Share.php#88

Parameters:
  • $token (string)
  • $checkPasswordProtection (bool)
Returns:

array | bool false will be returned in case the token is unknown or unauthorized

Since:

5.0.0 - parameter $checkPasswordProtection was added in 7.0.0

Deprecated:

17.0.0

public static OCP\Share::getItemsShared($itemType, $format=self::FORMAT_NONE, $parameters=null, $limit=-1, $includeCollections=false)
Get the shared items of item type owned by the current user
Source:

lib/public/Share.php#104

Parameters:
  • $itemType (string)
  • $format (int) (optional) Format type must be defined by the backend
  • $parameters (mixed)
  • $limit (int) Number of items to return (optional) Returns all by default
  • $includeCollections (bool)
Returns:

mixed Return depends on format

Since:

5.0.0

Deprecated:

17.0.0

public static OCP\Share::getItemShared($itemType, $itemSource, $format=self::FORMAT_NONE, $parameters=null, $includeCollections=false)
Get the shared item of item type owned by the current user
Source:

lib/public/Share.php#121

Parameters:
  • $itemType (string)
  • $itemSource (string)
  • $format (int) (optional) Format type must be defined by the backend
  • $parameters (mixed)
  • $includeCollections (bool)
Returns:

mixed Return depends on format

Since:

5.0.0

Deprecated:

17.0.0

public static OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status)
sent status if users got informed by mail about share
Source:

lib/public/Share.php#137

Parameters:
  • $itemType (string)
  • $itemSource (string)
  • $shareType (int) SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
  • $recipient (string) with whom was the item shared
  • $status (bool)
Since:

6.0.0 - parameter $originIsSource was added in 8.0.0

Deprecated:

17.0.0