cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
emfuentes27
Super User
Super User

Create/Upload Link to a SharePoint Document Library

This question is probably a mix between PowerApps and Power Automate, but I was not sure where to ask it.  I create an app using PowerApps that allows me to upload/create files in a SharePoint document library.  I used a tutorial by Matthew Devaney, and everything works just fine. There are another bunch of tutorials that work as well. The issue now is that I've been asked to also being able to add Links the Document Library. I added the "Content Type, and I'm able to add links using the default way of adding files to a document library:

Links.png

The issue is I need to add that link using a custom PowerApps app that adds more metadata to the file/link. I create the file using a flow, and I pass a few parameters from PowerApps. When I upload add attachment I trigger among other things:

 

OnAddFile:

Set(
    theValue,
    First(colAttachments).Value
);
Set(
    theName,
    First(colAttachments).Name
);

 

 

Then I have a button that triggers the flow, and passes the parameters:

 

OnSelect:
Set(responseFromFlow, CreateFile.Run(
        {
         contentBytes: theValue,
         name: theName
     },
     title_2.Text,
     description_2.Text,
     category_2.Selected.Value,
     docType_2.Selected.Type,
     yearPub_2.Text,
     ro_2.Selected.RO,
     originalName,
     linkField.Text //This is the field where the user will enter the url
   
 ).status);

 

 

My question is. If I'm creating a Link instead of an actual file, what would the  contentBytes, and name be? I'm guessing the name could be created removing the "https://" portion of the URL and then:

 

linkField.Text &'.url'

 

I have no idea about the contentBytes. 

 

This is a screen shot of a portion of the Flow:

flow.png

 

Any lead would be appreciated. Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
emfuentes27
Super User
Super User

I got it. When creating a link in a document library using the Create File from Power Automate. This site help me a lot. The File Should be the URL without the "HTTP://" portion, and add ".url" at the end. For the File Content, just use this format:

[InternetShortcut]
URL=https://google.com/

Links2.png

 Links1.png

View solution in original post

2 REPLIES 2
emfuentes27
Super User
Super User

I got it. When creating a link in a document library using the Create File from Power Automate. This site help me a lot. The File Should be the URL without the "HTTP://" portion, and add ".url" at the end. For the File Content, just use this format:

[InternetShortcut]
URL=https://google.com/

Links2.png

 Links1.png

Hi @emfuentes27 - would you mind sharing the updated parameters on the button for this solution? I'm having exactly the same problem, but I don't think I'm as good as you, so it would be helpful to see exactly how you achieved it! Thanks!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,257)