You need to use the Microsoft Graph API. There are examples and documentation around the web but it is in Beta so keep in mind the process might change.
You can use Get
on the sharepoint site and see the drive objects, Then you can connect to them using the Drive ID
and look at the webURL
property of the files.
https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/drive
I ended up constructing the link dynamically. So Here is what I ended up doing to get the link:
Here is an example
$UniqueID = (Get-PnPListItem -id 231 -List Budget).FieldValues.UniqueID
the $UniqueID = e1a1f20f-4b7d-4y16-x021-3469bde98088
Here are the link steps:
at the end just construct all steps to build your link dynamically. https://mycompany.sharepoint.com/Site/subsite/_layouts/15/WopiFrame.aspx?sourcedoc={e1a1f20f-4b7d-4y16-x021-3469bde98088}&action=edit
In the end the only id you will be changing is the unique id between the curly brackets.
Adding to what Nick says, we can use the Graph API to achieve this requirement in particular the " createLink " endpoint.
We can do a POST request with following body (or similar)
{
"type": "edit",
"scope": "organization"
}
and the request URL can be one of the following
- /v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem/createLink
- /v1.0/sites/{site-id}/drive/items/{drive-item-id}/createLink
- /v1.0/sites/{site-id}/drives/{drive-id}/items/{drive-item-id}/createLink
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.