I'm trying to create share links with REST API or a PowerShell script.
This is my scenario: I've a document library in my team site with many folders, each folder refer to an agent. Each agent has an external email address (es.: @gmail.com, @yourcompany.com etc) and they are not domain users.
Modern document libraries have "Share" button that allow to send a share link to a specific external address. This email address receive an e-mail where he can get a verification code. This is awesome.
But, I have about 300 folders and I'm trying to create these links with some code (REST API or PowerShell), because I've already a SharePoint list with the folder-agent match.
I've seen that is possible to create anonymous links, but this is not the way because I've to be sure that a folder is only readable for the invited user. Also I've seen that is possible to create invites to external users, but this method asks the external user to create/use a Microsoft account or an O365 account, and this is not good for me.
I've googled a bit and I've seen that there is an API that seems match my requirements:
But this doesn't seem documented and I can't find which properties I have to send in my POST request.