Get UNC path from a local path or mapped path
In Delphi there is a function ExpandUNCFileName that takes in a filename and converts it into the UNC equivalent. It expands mapped drives and skips local and already expanded locations. Samples C:\Folder\Text.txt -> C:\Folder\Text.txt L:\Folder\Sample.txt -> \\server\Folder1\Folder\Sample.txt Where L: is mapped to \\server\Folder1\ \\server\Folder\Sample.odf -> \server\Folder\Sample.odf Is there a simple way to do this in C# or will I have to use windows api call WNetGetConnection and then manually check the ones that wouldn't get mapped? There is no built-in function in the BCL which will do