I have 3 files inside a subsolder of my OneDrive, say "Documens/TopFolder/SubFolder"
I can list 3 files inside this SubFolder using
Get-PnPFolder -FolderRelativeUrl "Documens/TopFolder/SubFolder"
File1.xlsx File2.xlsx File3.xlsx
Now I want to share these 3 files with 3 different users, say
I am a user in my organization, so I don't have admin access to share point. I just started learning powershell.
Questions are:
How to get these 3 files into Get-PnPListItem
?
How to give permission for each file using windows powershell?
How to get the annonymus weburl link for each file to share with individual user?
You could use Set-PnPListItemPermission
to grant user permissions. Example:
Set-PnPListItemPermission -List 'Documents' -Identity 1 -User 'user@contoso.com' -AddRole 'Contribute'
Below articles may be helpful to you:
https://www.sharepointdiary.com/2016/09/sharepoint-online-set-folder-permissions-powershell.html