MS Graph API: unable to get users list of single file's permissions, instead of members, visitors and owners

Viewed 208

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
                    (
                    )

            )

    )

)
0 Answers
Related