none
Download File from Document library to local machine RRS feed

  • Question

  • Dear Team,

    I have a requirement where user wants to download file from sharepoint document library to their local machine(Downloads folder). On Chrome browser it is working fine as this is inbuilt feature of Chrome. But when It comes to Internet Explorer, it does not save directly to local drive of user's machine rather it just opens document. Can we download file directly to the user's machine from Internet Explorer just like Chrome does? I have tried WebClient as well but no use. Below is Piece of code:

    WebClient wc = new WebClient();
                            wc.Credentials = CredentialCache.DefaultCredentials;
                            MemoryStream mstream = new MemoryStream();
                            using (Stream davStream = wc.OpenRead(url)); //getting error as The remote server returned an error: (404) Not Found
                            {
                                int bytesRead = 0;
                                int bufferSize = 4096;
                                byte[] buffer = new byte[bufferSize];
                                while ((bytesRead = davStream.Read(buffer, 0, bufferSize)) > 0)
                                {
                                    mstream.Write(buffer, 0, bytesRead);
                                }

                            }

    Thanks a ton in advance!

    Wednesday, May 3, 2017 6:34 AM

All replies

  • hello, in IE click ... near file name so it will open context menu, then click ... below the opened context menu (after Open, Share, Post) and then click Download.


    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

    Wednesday, May 3, 2017 11:04 AM
  • Hi,

    You could find the download button from ribbon also.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, May 4, 2017 3:55 AM
  • Hi Shinde,

    In Addition to click on download button you can click on Open in Explorer view from IE browser, ribbon tool bar Doc library and copy the files/folders from explorer view and move it to anywhere on your local computer

    Second option you can navigate to Content and Structure Page, where you have many other options to perform action on documents.

    http://{YOURSITENAME}/_layouts/15/sitemanager.aspx



    KRISHANA KUMAR

    SharePoint Architect

    Mosstechnet-kk.com

     

    Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful

    Tuesday, May 9, 2017 9:31 PM