locked
restrict to download documents for particular times RRS feed

  • Question

  • I have a document library, i want users can view the documents and be able to download to particular no of times, such as each user can download only 10 times any document after that they can only view should not be able to download.

     

    Is it possible in sharepoint?


    Regards urvinit
    Friday, February 18, 2011 5:35 AM

Answers

  • I think it's not possible using OOB solutions. You have to write custom code.

    For example - handle each download event, increase the downloads count for the specified user (you have to store this info somewhere, for example in another custom list) and after reaching to the limit - just change user permissions on the list.

     

    _____________________________

    Zorayr Zakaryan Lightning Tools

    • Marked as answer by David HM Friday, February 25, 2011 2:05 AM
    Friday, February 18, 2011 8:20 AM
  • Hi urvinit,

     

    You may consider to create a workflow to do this. This method is same with Zorayr said above in theory. Create a list to restore the download counts of users. Each time after the user download is complete, add 1 to the download count of the user, then compare the download count with limit count, if download count is larger than limit count, change the download permission of the user.

     

    Thanks & Regards,

    Peng Lei

    • Marked as answer by David HM Friday, February 25, 2011 2:05 AM
    Monday, February 21, 2011 8:22 AM
  • Hi

    You can process the http context during the execution and check whether it related to your list or not.

    Here is one tutorial how to create httphandler for SP

    And here is an example how to get current list from httphandler.

     

    ____________________________

    Zorayr Zakaryan Lightning Tools

    • Marked as answer by David HM Friday, February 25, 2011 2:05 AM
    Wednesday, February 23, 2011 7:46 AM

All replies

  • I think it's not possible using OOB solutions. You have to write custom code.

    For example - handle each download event, increase the downloads count for the specified user (you have to store this info somewhere, for example in another custom list) and after reaching to the limit - just change user permissions on the list.

     

    _____________________________

    Zorayr Zakaryan Lightning Tools

    • Marked as answer by David HM Friday, February 25, 2011 2:05 AM
    Friday, February 18, 2011 8:20 AM
  • Hi urvinit,

     

    You may consider to create a workflow to do this. This method is same with Zorayr said above in theory. Create a list to restore the download counts of users. Each time after the user download is complete, add 1 to the download count of the user, then compare the download count with limit count, if download count is larger than limit count, change the download permission of the user.

     

    Thanks & Regards,

    Peng Lei

    • Marked as answer by David HM Friday, February 25, 2011 2:05 AM
    Monday, February 21, 2011 8:22 AM
  • Hi Peng and Zorayr, Thanks for replying... Is there any SPListItemEventReciever to check downloads(like ItemAdded) on which event i can count no of downloads.how i will know that the item is being downloaded. Can u give me any reference of something like this through which i can get help.
    Regards urvinit
    Tuesday, February 22, 2011 5:51 AM
  • Hi

    As I know, there is no smart way to handle download event, and instead of you have to customize your interface (to handle download clicks) or maybe use custom HttpHandler to handle each request.

     

    _____________________________

    Zorayr Zakaryan Lightning Tools

    Tuesday, February 22, 2011 9:29 AM
  • There is no way to track the downloads through event handlers, you need to intercept the request in Http pipeline.You need to develop a httphandler to track the downloads. Track all requests through this handler and put a keyvalue pair in session/database for each user per request. Validate the stored keyvalue pair before kick starting the actual download. Refer this artice:-http://www.devx.com/codemag/Article/34535
    Aravind http://aravindrises.blogspot.com
    Tuesday, February 22, 2011 5:39 PM
  • Hi,

    how i will attach the httphandler to a particular document library.


    Regards urvinit
    Wednesday, February 23, 2011 7:35 AM
  • Hi

    You can process the http context during the execution and check whether it related to your list or not.

    Here is one tutorial how to create httphandler for SP

    And here is an example how to get current list from httphandler.

     

    ____________________________

    Zorayr Zakaryan Lightning Tools

    • Marked as answer by David HM Friday, February 25, 2011 2:05 AM
    Wednesday, February 23, 2011 7:46 AM