so far I've been using the System.IO.Path.GetFullPath to compare paths as per the answers in Verifying path equality with .Net.
However, I now encountered an error with links to the desktop, which is something like "https://mycompany-my.sharepoint.com/personal/myname_mycompany_com/Documents/Desktop/". It's a path to an Excel workbook that I retrieve via _workbook.FullName within the code.
Path.GetFullPath throws a NotSupportedException when fed this link.
I have now researched two things.
- Trying to avoid the sharepoint path by getting a "local" path to the desktop like "C:\Users\myemployeenumber\OneDrive - mycompany\Desktop"
- Trying to find a method to compare paths that has all the advantages of Path.GetFullPath and additionally accepts the sharepoint path.
Unfortunately, after hours of looking I wasn't successful with either of the two. 1) seems to be impossible?! The closest I came with 2) was checking that Path.GetFullPath(Uri(path).LocalPath)) and Uri(path).Host are both equal (ignoring upper/lower case) for the two paths that I am comparing but then the Uri(path).LocalPath does not work for relative paths...
Would be very grateful if someone could help me with either 1) or 2).
Thanks
EDIT, Update on what I ended up doing: We noticed that also other things broke with paths to the Desktop (Sharepoint), e.g. File.Exists(), File.Copy(). While it seems possible to write wrapper functions for all file handling operations that also allow sharepoint paths (e.g. How to download/upload files from/to SharePoint 2013 using CSOM?), we have decided for now to not support sharepoint locations for our application.