locked
download items from a listviewbyquery web part into excel file RRS feed

  • Question

  • Hi,

    Am having a doc lib view, I mean, I used listviewbyquery web part to display the items from doc lib.

    Now I have the requirement to download  all those  items in the  listviewbyquery web part to an excel file.

    is this possible.

     help is appreciated!


    Das

    Monday, January 5, 2015 11:03 AM

Answers

All replies

  • You can use export to excel option.
    Monday, January 5, 2015 11:14 AM
  • use export to excel option in ribbon menu

    or

    create a console application that gets the file using the standard URL (see this post) and saves it wherever you want. Otherwise, maybe you can just export it to CSV using PowerShell. See an example here.

    • Proposed as answer by SekThang Monday, January 5, 2015 11:30 AM
    Monday, January 5, 2015 11:27 AM
  • I need to download the document also not only the metadata associated with the item/document.

    i dont think the export to excel will provide me this.


    Das

    Monday, January 5, 2015 11:45 AM
  • can someone pls provide help in this...

    Das

    Tuesday, January 6, 2015 6:56 AM
  • Hi Das,

    Based on your description, you might want to download items as well as documents from a ListViewByQuery web part.

    There is no such API in both SharePoint Object Model or Client Object Model can help to access a ListViewByQuery web part in a page directly like what we can do to a list/library, I would suggest you query/download data from the source library using SharePoint Object Model if the query or filter condition in the ListViewByQuery web part is available to you.

    If there is need to do the job against the ListViewByQuery web part directly, a workaround is that we can use JavaScript to gather the data needed(such as item id, file URL) from HTML source of the web part in a page, then download the related documents to the local machine using Server Object Model.

    How to search elements in HTML source code using JavaScript:

    http://javascript.info/tutorial/searching-elements-dom

    A code demo about how to download files to local machine:

    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/369fb601-e51b-4a36-9246-70cf559133cc/programatically-download-files-from-sharepoint-document-library?forum=sharepointdevelopmentprevious

    Best regards

    Patrick Liang
    TechNet Community Support

    • Marked as answer by Dennis Guo Monday, January 19, 2015 1:08 AM
    Friday, January 16, 2015 1:33 PM