I am going to have Flows running on many sites and keeping a separate history of all approvals across all the modern sites. The flows will run on typical document libraries doing standard-like approvals. I have it all working, I just need the URL of the site collection. I've tried expressions to split the URL of a file, but struggling with where to stop. I just think Flow has to know where it is.
If I peek code at the trigger, I can see it there under parameters called dataset:
The workflow() expression only dumps info of the environment which doesn't include the site URL. Anyone know how I can reference this information? Just seems like it should be easier than this.
Another way to achieve this solution is to use uri functions to construct the site collection Url. Add the action Compose (Data Operation) to your flow. Then under the Expression tab, add uriScheme (protocol) and uriHost (hostName) inside a concat function.
@Anonymous I got this to work on the datset value that you mentioned:
trigger()['inputs']['parameters']['dataset']
@Anonymous thank you
Hi @Anonymous ,
My mistake, I was lazy in posting my last reply and you have some bracketing errors in your expression. *hint: Use Notepad++ to write up the expressions*.
You cannot use a minus directly in an expression. You need to use sub instead. Your expression after correction should look like this:
substring(outputs('Get_file_properties')?['body/{Link}'],0,sub(length(outputs('Get_file_properties')?['body/{Link}']),length(outputs('Get_file_properties')?['body/{FullPath}'])))
Regards,
Kailash
@Anonymous i am in need of the site url too and i saw your formula but it isnt working for me. Can you help me fix this?
Hi,
You can achieve the same result by using some of the properties of the SharePoint item like "Link to Item" and "Full Path".
The formula would be:
substring("Link to Item",0, length("Link to Item")-lenght("Full Path")-1)
Regards,
Kailash
This worked, thanks!
Hi @Anonymous ,
The site Url cannot be obtained directly through For a selected file.
Please refer to the method below to get Site Url.
Expression:
first(split(body('Get_file_properties')?['{Link}'],concat('/',body('Get_file_properties')?['{Path}'])))
Image reference:
Flow run history:
Please take a try.
Best Regards,
stampcoin
59
Michael E. Gernaey
47
Super User 2025 Season 1
rzaneti
29
Super User 2025 Season 1