cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamieD76
Level: Powered On

Passing Doc Library Folder Path in the URL

Hi All,

 

I have put together a basic JSON Script that opens my PowerApp and send the ID of the currently selected file in a document library.

 

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/sp/column-formatting.schema.json",
  "elmType": "a",
  "attributes": {
    "iconName": "Mail",
    "target": "_blank",
    "href": {
      "operator": "+",
      "operands": [
        "https://web.powerapps.com/apps/d85a1236-6d47-4f28-97c3-9309396fxxxx?DocID=",
        "[$ID]"
      ]
    }
  }
}

 

 

This works fine PowerApps is opened and I can extract the ID into a variable and then get more information by connecting to the document library and looking up the information based on the ID.

 

The problem is this is fine for one Document Library but I need to use this script across muliple document libraries meaning multiple Data Connections.   I plan to pass the folder path in the URL and then use an if Statement to determine which library to connect to.

 

Could anybody help my to Structure the URL Code I am really struggling to Append the FilePath, I assumed it would be something like

 

   
        "https://web.powerapps.com/apps/d85a1236-6d47-4f28-97c3-9309396fxxxx?DocID=",
        "[$ID]"&FilePath="[$FilePath]"

 

But this does not seem to work.

 

Many Thanks

Jamie

1 ACCEPTED SOLUTION

Accepted Solutions
YuliyaHaradniuk
Level: Powered On

Re: Passing Doc Library Folder Path in the URL

yes, it worked! my powerapps app was just too slow to display the published changes. One more question. Have you ever figured out how to pass file path in the url?

View solution in original post

9 REPLIES 9
Community Support Team
Community Support Team

Re: Passing Doc Library Folder Path in the URL

Hi @JamieD76,

 

Could you please share a bit more about your scenario?

Do you want to open your PowerApps app using URL link and pass a SP folder path variable into it?

 

Please take a try to modify your formula as below:

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/sp/column-formatting.schema.json",
  "elmType": "a",
  "attributes": {
    "iconName": "Mail",
    "target": "_blank",
    "href": {
      "operator": "+",
      "operands": [
        "https://web.powerapps.com/apps/d85a1236-6d47-4f28-97c3-9309396fxxxx?DocID=",
        "[$ID]",
         "&FilePath=",
         "[$FilePath]"
      ]
    }
  }
}

then check if the issue is solved on your side.

 

In addition, if you want to pass parameters into a PowerApps app, please check if the following article would help in your scenario:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/embed-apps-dev#set-uri-parameters-for-y...

 

 

Best regards,

Kris 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
YuliyaHaradniuk
Level: Powered On

Re: Passing Doc Library Folder Path in the URL

would you be able to explain how you extract the ID into variable? 

Super User
Super User

Re: Passing Doc Library Folder Path in the URL

@YuliyaHaradniuk 

Param(DocID) in this case.

 

Take a look at the Param function for more details.

 

Hope this helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
YuliyaHaradniuk
Level: Powered On

Re: Passing Doc Library Folder Path in the URL

yes, it worked! my powerapps app was just too slow to display the published changes. One more question. Have you ever figured out how to pass file path in the url?

View solution in original post

Super User
Super User

Re: Passing Doc Library Folder Path in the URL

@YuliyaHaradniuk 

Out of curiosity, why are you trying to pass all this information into PowerApps rather than get it from within PowerApps?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
YuliyaHaradniuk
Level: Powered On

Re: Passing Doc Library Folder Path in the URL

I have a scenario where I need users to fill out a form first before they can open a specific document in the document library. I was thinking to create a button (custom formatted field) for each document in a document library that would open a PowerApps form and pass DocID and other parameters to the app. In the app I would ask users to fill out additional fields, and only when submitted, a user will be navigated to the file (either through launch function or a link on confirmation page). I guess i'm struggling with getting a link in the app back to the file.

Super User
Super User

Re: Passing Doc Library Folder Path in the URL

@YuliyaHaradniuk 

I thought there might be something like that going on...

So, the reality is, the only thing you need is the ID of the document item in the library.

How are you building your App?  As an App or an integration to your Library list?

 

Either way, both will give you the information you need.  If it's an integration, then you can get most everything you need from the SharePointIntegration with the SelectedListItemID.  If it is a custom App, then you can just Lookup the ID or, in your case you are passing in the parameter for the DocID already.

 

In your App, have a connection to the Document Library and lookup the Item.

You will then have every bit of information you need from the Library.

 

So, again, 1) pass in the ID via URL, or with SharePointIntegration, you've got it already.  2) Lookup the item in the library by ID and you will have all information needed.

 

Hope this is clear and sheds some light.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
YuliyaHaradniuk
Level: Powered On

Re: Passing Doc Library Folder Path in the URL

I'm building my app off a separate sharepoint list (same site) but it will be launched from the document library (via formatted column). I need a user to submit some information before they can open a file. The information will be saved in this SharePoint list and not Sharepoint library where the file lives. Hope this makes sense. 

Super User
Super User

Re: Passing Doc Library Folder Path in the URL

@YuliyaHaradniuk 

Yup...makes perfect sense and the scenario I layed out still applies...pass the ID for the item in the Doc library and then get everything you need from a lookup in PowerApps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,808)