0

I am using the API (HTTP Request through PowerAutomate) to create a share link for a file that is being submitted via a Form.

This share link will be displaying a PDF and needs to have certain permissions, such as View by everyone + Block Download.

I can do this via the GUI fine, but when using the API I am unsuccessful in blocking the download.

I am using a POST to URI- _api/web/GetFileByUrl(@v)/ListItemAllFields/ShareLink?@v='@{outputs('Compose_2')}'

Outputs of Compose_2 is the Relative path of the file submitted via the form.

The body of the request is-

bodyofAPIrequest

The request is hitting the API and I am getting a response. The link created is one that anyone can view, which is perfect, but I still cannot get "Block Download" to work. Everywhere I have read, says role 7 should block the download. Can anyone point me in the direction of some documentation that would help!

Thanks!

1 Answer 1

0

If you are referring below settings

enter image description here

Then you can use following request data:

    {
  "request": {
    "createLink": true,
    "settings": {
      "allowAnonymousAccess": true,
      "linkKind": 6,
      "expiration": null,
      "role": 7,
      "restrictShareMembership": false,
      "updatePassword": false,
      "password": null,
      "scope": 0
    }
  }
}

As this is API is not properly documented anywhere by Microsoft, I would always use Fiddler Classic to where you can do operation in SharePoint and use Fiddler to check what request data is being sent by SharePoint.

Below are available options for different property to be passed with request data. As it's enum, input should be provided in number and it will start with 0,1, and so on.

linkKind

enter image description here

role

enter image description here

scope

enter image description here

2
  • Sorry for the late reply. I have been away! Thankyou so much for answering though! Works perfect!
    – ZC1111
    Commented Oct 9, 2022 at 21:41
  • Please mark this answer if it works for so that it can be helpful to other person Commented Oct 11, 2022 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.