I have a file in a Document Library. I can reach that file with a direct URL in the form
Now what I'm trying to do is create a List View Command Set that will post the document to an API, something like:
Request.addFileByUrl('....') and pass the URL of the document as a parameter.
The problem is, I get a message "LinkKind cannot be Direct or Uninitialized". I've played around with some of the admin sharing settings to no avail. So my question is, is there a way to allow access to a direct URL temporarily or even somehow get the original document from the share link? Is there an option to integrate that method into a Command Set extension? (I am using the pnp/sp library at the moment to get the links)
Thank you for your help
Here's the code that I am using to get the share link from my List View Command Set:
let getLink = await sp.web.getFileByServerRelativePath(filePath).getShareLink(SharingLinkKind.Direct, dateAdd(new Date(), "minute", 20)); let url: string = getLink.sharingLinkInfo.Url;
Now obviously the SharingLinkKind.Direct is the line that is giving me the error message, but I don't know how to work around it.