I want to create a button which redirect users to "Explorer view" in SharePoint 2010. The problem is : i don't know how to get the url of the original button "Open With Windows Explorer". I tested many things without success, like Process.Start("explorer.exe","url of documents library")
In my case the two target shortcuts look like this
Internet Explorer: https://COMPANYNAME.sharepoint.com/sites/LIBRARY
Windows Explorer: \\COMPANYNAME.sharepoint.com@SSL\DavWWWRoot\sites\LIBRARY
I am on Office 365 Sharepoint 2013 and on a Windows 7 machine.
With the following HTML you can open this URL with a button:
<input
type="button"
onclick="window.open( 'file:\\\\COMPANYNAME.sharepoint.com@SSL\\DavWWWRoot\\sites\\LIBRARY' )"
value="Explore"
/>
In case your URL contains any spaces you need to encode them as %20, for other encodings see: http://www.w3schools.com/tags/ref_urlencode.asp
Update: Within Windows Explorer the \\COMPANYNAME.sharepoint.com@SSL\DavWWWRoot\sites\LIBRARY
need to be added to "Quick Access" section (top left hand side). Otherwise the solution is not persistent.
You can use the same method as the SharePoint ribbon:
<a onclick="CoreInvoke('NavigateHttpFolder', '/MyDocLibrary', '_blank');">Open with Explorer</a>
The CoreInvoke function worked PERFECTLY (thanks AleNom!).
I created a function that will dynamically open Explorer from wherever your are on the SharePoint site. I'm calling it from a custom button I put in the toolbar (masterpage).
function openExplorer()
{
if(getQueryString("RootFolder")!="")
{
var strURL = getQueryString("RootFolder")
}
else
{
var strURL = top.location.href.replace("http://[servername]","")
var intLastSlash = strURL.lastIndexOf("/")
strURL = strURL.substring(0,intLastSlash)
}
if (strURL.lastIndexOf("/Forms") >-1)
{
strURL = strURL.substring(0,strURL.lastIndexOf("/Forms"))
}
CoreInvoke('NavigateHttpFolder', strURL, '_blank')
}
function getQueryString(name)
{
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With