Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link to "Open with Windows Explorer" on SharePoint 2010

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")

like image 582
cinou01 Avatar asked Nov 12 '12 15:11

cinou01


3 Answers

  1. Within your browser go to the Sharepoint project site and click on the button with the label Open with Explorer.
  2. Within Windows Explorer, right click on a folder of your project site and select Create Shortcut.
  3. Right click on the new shortcut and select properties
  4. On the tab shortcut under target you can find the URL you need.

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.

like image 79
Ruut Avatar answered Sep 28 '22 19:09

Ruut


You can use the same method as the SharePoint ribbon:

<a onclick="CoreInvoke('NavigateHttpFolder', '/MyDocLibrary', '_blank');">Open with Explorer</a>
like image 23
AleNom Avatar answered Sep 28 '22 17:09

AleNom


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, " "));
}
like image 31
Sam Rose Avatar answered Sep 28 '22 19:09

Sam Rose