Create an url to an editable view of the file. By default, a public shared link will be created.
OneDrive Premium and Business accounts can request an expiring shared link or set a password.
Parameters
Name
Type
Description
$id
string
ID of the entry
$param
array
Additional sharing permissions. Defaults to:
Return
Name
Type
Description
$url
string
The created link
Usage
WPCP_ONEDRIVE_API::set_account_by_id('8c9bacda0-d8d8-4b22-b634-7b5281687575');
WPCP_ONEDRIVE_API::set_drive_by_id('b!DlaHWskCed_MIid3KpJH5Lbatf9HsdXBAZH5YcvPAbMhJUKzTJyzgvXZYpBS');
$params = [
'type' => 'edit',
'scope' => 'anonymous',
];
// Set password
// !!! Only available for OneDrive Business
$params['password'] = 'mypass1234';
// Set expire date
// !!! Only available for OneDrive Business
$expire_date = current_datetime()->modify('+1 month');
$params['unshared_at'] = $expire_date->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d\TH:i:s\Z');
// Create / Get shared links
$url = WPCP_ONEDRIVE_API::create_edit_url('01EXLSWHWMQZNDMLRG7NFIWAVYCFJAXP2R', $params);
Parameters
Name
Type
Description
$id
string
ID of the entry
$params
array
Additional params for sharing permissions. Default:
Return
Name
Type
Description
$url
string
The created link
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$params = [
'role' => 'writer'
];
// Get edit url and update sharing permissions
$edit_url = WPCP_GDRIVE_API::create_edit_url('1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7', $params);