9

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?

1
  • 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. Commented Aug 14, 2012 at 12:57

1 Answer 1

9

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.