Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer

up vote 4 down vote accepted

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

share|improve this answer
    
Works like a charm, thanks a lot! –  Hatch Aug 14 '12 at 14:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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