2

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] => Vordingborg@appvelo.onmicrosoft.com
                                [id] => 34c98482-0149-4d7f-9875-73c34047b0dd
                                [displayName] => Vordingborg Owners
                            )

                    )

                [inheritedFrom] => Array
                    (
                    )

            )

    )

)
Amir Khan
  • 401
  • 5
  • 13
  • You can get the data of the users in the grantedTo property. The above ones are default data about permissions and each and every new file has these records. If you add permissions using [ADD Permission](https://learn.microsoft.com/en-us/graph/api/driveitem-invite?view=graph-rest-1.0&tabs=http) then you can see one more record which you would add to a user. – Shiva Keshav Varma Nov 18 '20 at 13:00

0 Answers0