php - MS Graph API: unable to get users list of single file's permissions, instead of members, visitors and owners
Get the solution ↓↓↓I am trying to get file permission list of users (email id name etc), using path and also tried using id of file but it shows array of members, owner and visitors. I want to check how many users has access to that specific file and i want to delete or update the permissions of specific users/user. you can see my code and response in below screenshots.
Code
$data = $graph->createRequest('GET', '/sites/0ae7cea9-8064-4e26-820d-839030aa60f9/drive/root:/SafeJournal/Borgere/Rasmus SГёrensen/ali.docx:/permissions')
->setReturnType(Model\User::class)
->execute();
Response
Array
(
[0] => Microsoft\Graph\Model\User Object
(
[_propDict:protected] => Array
(
[id] => Vm9yZGluZ2JvcmcgT3duZXJz
[roles] => Array
(
[0] => owner
)
[grantedTo] => Array
(
[user] => Array
(
[displayName] => Vordingborg Owners
)
)
[inheritedFrom] => Array
(
)
)
)
[1] => Microsoft\Graph\Model\User Object
(
[_propDict:protected] => Array
(
[id] => Vm9yZGluZ2JvcmcgVmlzaXRvcnM
[roles] => Array
(
[0] => read
)
[grantedTo] => Array
(
[user] => Array
(
[displayName] => Vordingborg Visitors
)
)
[inheritedFrom] => Array
(
)
)
)
[2] => Microsoft\Graph\Model\User Object
(
[_propDict:protected] => Array
(
[id] => Vm9yZGluZ2JvcmcgTWVtYmVycw
[roles] => Array
(
[0] => write
)
[grantedTo] => Array
(
[user] => Array
(
[displayName] => Vordingborg Members
)
)
[inheritedFrom] => Array
(
)
)
)
[3] => Microsoft\Graph\Model\User Object
(
[_propDict:protected] => Array
(
[id] => Yzowby5jfGZlZGVyYXRlZGRpcmVjdG9yeWNsYWltcHJvdmlkZXJ8MzRjOTg0ODItMDE0OS00ZDdmLTk4NzUtNzNjMzQwNDdiMGRkX28
[roles] => Array
(
[0] => owner
)
[grantedTo] => Array
(
[user] => Array
(
[email] => [email protected]
[id] => 34c98482-0149-4d7f-9875-73c34047b0dd
[displayName] => Vordingborg Owners
)
)
[inheritedFrom] => Array
(
)
)
)
)
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: attempt to read property "id" on null
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.