Getting a List of Files from a Sharepoint Shared Link

Written by James McDonald

January 27, 2022

So recently I had a customer ask if they can be notified when the files change in a Microsoft Teams Sharepoint URL which was shared with Contribute permissions with sign-in NOT required.

The link provided did not allow the person to choose “Sync” and then mirror the folder structure in their Own OneDrive
And there doesn’t appear to be a way to set up alerts because you can’t alert “anonymous”.

An example of the link provided is the following:

When you click on a sharepoint Shared Link URL similar to the above ( While not authenticated ) it will redirect you to the “proper” URL similar to the following and allow you to access the files.

Once you have the above URL you can get the list of files in XML format by editing the URL to include this snippet _api/web/lists/getbytitle(‘Documents’)/items?‘Documents’)/items?$select=FileLeafRef,FileRef&id=%2Fsites%2Fmytestteamsite%2FShared%20Documents%2FTestSharedFolder&p=true

Requesting the above URL will return an XML list of filename (FileLeafRef) and filepath (FileRef) which you can then compare programmatically with previous output and alert people via email when a change happens.


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Network speed test host to host

On Ubuntu / Debian apt-get install iperf3 On Windows download it from Make...

Clear HSTS Settings in CHrome

Open chrome://net-internals/#hsts enter the domain in the query field and click Query to confirm it has HSTS settings...