Using the microsoft-graph library I am able to create shareable links as follows:
use Microsoft\Graph\Graph;
$data = [
'type' => 'edit',
'scope' => 'organization',
];
$url = '/drives/'.$driveId.'/items/'.$driveitemId.'/createLink';
$link = $this->graph->createRequest("POST", $url)
->attachBody($data)
->execute();
The above is successful.
What I really want to do is create an 'anonymous' link so that people outside of the organization have access to the file. However, if I change the scope to 'anonymous' then the above link creation fails. Likewise, if I go to Onedrive on the web, I cannot share the link with anyone as it says that my organization is preventing me from selecting the option.
The API documentation does say that "Anonymous link support may be disabled by an administrator.", however it doesn't say where or how to enable or disable anonymous link support.
The idea is that the link will initially be editable, but will be later changed to read only.
Please could you tell me where I can enable this support so that I can manage the link using microsoft-graph API.
Apologies in advance @JosephXu-MSFT - you are the only person I know to tag, please forward as appropriate.




