I've been working on opening sharepoint files with VBA (reference PowerPoint decks via a ribbon button).
I'm using "Application.ActivePresentation.FollowHyperlink SharePointPath" which is working fine.
The constant SharePointPath is the direct SharePoint link for the files I want, which takes this form:
I've been testing different combinations of replacing the file in place, changing the filename, etc. to see how this can be broken and have noticed a strange behaviour. When I:
- Uploaded a different file to the same folder
- Deleted the original file
- Renamed the new file to the filename of the old file
I got a different "sourcedoc" (the bit in blue), however, the original link still worked.
To play out the example:
- I uploaded a file, which had this path
https://tenant.sharepoint.com/:p:/r/sites/sitecollection/_layouts/15/Doc.aspx?sourcedoc=xxxxxx&file=originalfilename.pptx (this path was put in the constant "SharePointPath" in VBA)
- I uploaded a new file, which had this path
- I renamed the new file to the filename of the original file, which then had this path
- Then tried "Application.ActivePresentation.FollowHyperlink SharePointPath" WITHOUT updating SharePointPath (so the path was the xxxxxx path) and it still successfully opened the new file.
So my question is, what is that "sourcedoc" reference? What does it represent and why didn't it matter that I changed it? I have seen it is a "document_GUID" but not clear on how it works why it didn't matter that it changed