Get UNC for WebDav folder from Sharepoint doc library URL (1 Viewer)

Isaac

Lifelong Learner
Local time
Today, 03:15
Joined
Mar 14, 2017
Messages
5,197
It's been years since I did this. Looking at the information here, but must not be getting it quite right. Does anyone know how I would get the UNC for a WebDav folder, in the format \\UNC , for this document library?

Code:
https://text.text.text.com/sites/site1/site2/_layouts/15/start.aspx#/Test20200930/Forms/AllItems.aspx

(I've replaced portions of the actual server with 'text')

Please note that I am not talking about mapping to a drive, but rather getting the full UNC in the \\ format that can actually be pulled up directly in Explorer with no further preparation.
 
Last edited:

Isaac

Lifelong Learner
Local time
Today, 03:15
Joined
Mar 14, 2017
Messages
5,197
Oh, darn, I just figured it out!
\\text.text.text.com@SSL\DavWWWRoot\sites\site1\site2\Test20200930

I got it by first going online to doc library, Open in Explorer, then right-click on one of the actual files inside the folder, going to Properties, then viewing Location. Yay!!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:15
Joined
Oct 29, 2018
Messages
15,268
Oh, darn, I just figured it out!
\\text.text.text.com@SSL\DavWWWRoot\sites\site1\site2\Test20200930

I got it by first going online to doc library, Open in Explorer, then right-click on one of the actual files inside the folder, going to Properties, then viewing Location. Yay!!
Hi. Glad to hear you got it sorted out. I used to go to the Library Ribbon in SharePoint and click on the Open with Explorer button. Does that not work anymore? Just curious...

Edit: Oops, you said "Open in Explorer," I think that's the same thing I was thinking of. Sorry...
 

Isaac

Lifelong Learner
Local time
Today, 03:15
Joined
Mar 14, 2017
Messages
5,197
I used to go to the Library Ribbon in SharePoint and click on the Open with Explorer button. Does that not work anymore? Just curious...
After you click "Open in Explorer", in the resulting window's address bar, you still have a HTTP address, not a \\unc address.

It works, if your purpose is to either 1) begin editing files at that point manually, or 2) use vba to map a network drive to that location and then programmatically work with files therein.
Without mapping a drive letter, there isn't much you can programmatically do - for example, I can't do:
Code:
Workbooks.Open("URL address.xlsx")
, or
Code:
Fso.OpenTextFile("URL address.txt")

My end goal recently has been to figure out how to programmatically (using VBA - like from Excel), actually save data to a sharepoint location - anything, Excel, text file, etc. We have a lot of corporate users who are on totally different networks across the globe. The only thing they have in common is Sharepoint access. It would be very valuable to me if we could deploy workbooks to them with vba that saves stuff to a Sharepoint location.

I'd tried the route of programmatically mapping a network drive letter to a sharepoint doc library and then working with files therein - like then I can code to open a text file G:\filename.txt
But that route brought up a lot of problems. I can't remember them right now. I got it working, but it was unreliable depending on the user's location.

This route means I can directly reference a file in a Sharepoint document library using unc rather than url/http
So now I can simply:
FSO.OpenTextFile("\\text.text.text.com@SSL\DavWWWRoot\sites\site1\site2\Test20200930\filename.txt")

Which is invaluable to me. I still have to test it on an overseas partner though..
 

Users who are viewing this thread

Top Bottom