I have a strange behaviour when I try to use a C# program to copy local files to a Sharepoint Server using UNC paths provided by Sharepoint to access the file system. First of all, my user has all the privileges required to access that specific Sharepoint-folder.
This is what my operation basically looks like:
string targetSharepointPath = @"\\team.mycompany.com@SSL\DavWWWRoot\team\wmscompanydep\Software Releases\MyToolConfig"
System.IO.File.Copy(sourcePath, targetSharepointPath, false);
This fails with an error "The network path was not found."
As soon as I copy the path above and paste it into WIndows File Explorer (not internet explorer, this is simply an UNC path), everything works.
So my assumption is, that in the background, Windows explorer does a little bit more. But what? I do not have to enter any credentials, the targetSharepointPath simply works in explorer, and as soon as this was entered once, it also works in my C# program. Until I restart my system, I have to repeat that step. Why, and how can I achieve that programatically? I work with UNC paths on "normal" Windows servers a lot, and once the user has rights I do not need any additional authentication.