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

john john 956 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.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,638 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,902 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 34,821 Reputation points Microsoft Vendor
    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 Answers by the question author, which helps users to know the answer solved the author's problem.