8

I have a custom layouts page that contains a custom visual WebPart. This WebPart wraps a XsltListViewWebPart with a toolbar. The toolbar is supplied as a RenderingTemplate. The XsltListViewWebPart provides a view on a document library. So far, everything works.

My problem is: that toolbar needs a button that when clicked calls the SharePoint "Open with Explorer" command that you get in the Ribbon menu of a document library.

<wssuc:SPToolBarButton runat="server" 
                       ID="tbbOpenWithExplorer" 
                       Text="Open with Explorer" 
                       OnClientClick="**???**" />

How can I call the "Open with Explorer" command?

  • Why not trace what JS calls get made when you click the button from a document library? Then you can just copy the calls. You can do this in the F12 Developer Tools. – RJ Cuthbertson Aug 14 '12 at 12:57
7

You need to CoreInvoke a function called NavigateHttpFolder to achieve this.

Try using this script:

OnClientClick = "javascript:CoreInvoke('NavigateHttpFolder', yourHttpPathToOpen, '_blank');"

this is how the SP ribbon calls the Open With Explorer function. Search for NavigateHTTPFolder in view-source to check it out :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.