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'm trying to force open/save dialog for all files in a document library, how can i achieve this?

What i've trying until now: - document library -> definitions -> advanced definitions -> open in client application - IIS -> MIME TYPES -> set some as application/octet-stream

Thanks, David Esteves

share|improve this question
add comment

2 Answers 2

Why?

Do you mean prompt the user to save the file, you don't want it to open automatically in Office?

Just for a library or for your entire site/web app? There's a setting in central admin where you can disable client connectivity, which will simply treat documents like links to open a file, with no integration in SP. However this is a web app setting, not site collection or library.

share|improve this answer
    
Yes, i mean prompt the user to save the file, not only office files, but also any type of file, images, pdfs... I also want to affect every document library in the web application. Thanks for the feedback. –  David Esteves Nov 8 '11 at 14:27
    
(from memory, forgive me if i'm off) In Central Admin > Application Settings > Authentication Providers, select your zone and there is a setting in there for Client Connectivity., Uncheck that and see if that works for you If you can't find it, let me know and I'll get into a SP2007 box. –  David Lozzi Nov 8 '11 at 15:03
    
Nop, i tried but no results. I think it has a slightly different purpose. It can be somehow related with the DispEx javascript function: siolon.com/blog/adding-edit-dialog-to-a-data-form-web-part I'll try to add a dataform to check if the dialog pops-up. –  David Esteves Nov 8 '11 at 15:40
    
Ok, then I think it might be up to the individual browsers, there's a setting in Windows or IE to say open certain file types, or prompt to download. –  David Lozzi Nov 8 '11 at 15:57
    
Thanks for the input. –  David Esteves Nov 9 '11 at 12:22
add comment
up vote 0 down vote accepted

Well i couldn't find any option at SharePoint, to disable the default behavior. So i just override it with jquery.

Basically SharePoint has a page called download.aspx (located at 12 hive -> LAYOUTS -> Layouts) this page allows to download a file specified in a query string parameter (SourceURL).

The following script must be used at the page containing the library ex: AllItems.aspx

<script type="text/jscript">

$(document).ready(function() {
    $("a[onclick*='DispEx']").each( function(data){
        var href = this.href;
        this.href = '/divisaojuridica/portal/pedidos/_layouts/download.aspx?SourceURL=' + this.href;
    });
    $("a[onclick*='DispEx']").removeAttr('onclick');
});
</script>
share|improve this answer
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.