Is there an API which mimic Share a file and define "People you chose" which can be new/existing external users?

john john 1,026 Reputation points
2023-03-26T11:47:13.29+00:00

Inside the SharePoint UI we can share a file with "People you chose" and we can define both internal users, new external users or existing external users, as follow:-

enter image description here

Now I have a Power Automate flow and I want to share a file with internal and external users using the same approach. but seems Power Automate does not provide an out of the box action for this scenario, so can we use SharePoint REST API?

  1. Where I can share the file with internal/external
  2. Get the file link
  3. Send the link in an email

Is this possible? I do not want the Share action to send notification directly, I want to get the link and send it using another Send Email action?

Thanks.

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2023-03-27T01:27:53.4966667+00:00

    Hi @john john ,

    You could try following two api to create a sharelink

    /_api/Web/Lists/GetByTitle(‘Documents’)/Items(1)/sharelink
    
    

    or

    /_api/web/GetFileByUrl(@v)/ListItemAllFields/ShareLink?@v='/sites/testsite/Mylib/test.txt'
    
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.