I’ve seen this question come up a few times, and I always forget the answer when I see it. So this post is more of a reminder to myself than anything!
Shared Folders in WHS use localised names. For example, the French \\server\Software share is actually \\server\Logiciel. If you’re writing code that needs to manipulate files in a specific Shared Folder, you need to know the localised name of the share you’re working with.
Enter Microsoft.HomeServer.Controls.ShareManager, referenced from HomeServerControls.dll. This static class exposes a whole lot of interesting methods and properties, but we care about these ones:
public static string MusicShareName { get; }
public static string PhotosShareName { get; }
public static string PublicShareName { get; }
public static string RecordedTVShareName { get; }
public static string SoftwareShareName { get; }
public static string VideosShareName { get; }
These properties return the localised name for each built-in Shared Folder. Now we can build our UNC path from the server’s name and the localised share name.