SharePoint中默认打开PDF(不下载)

在SharePoint2010中,需要在浏览器中默认打开PDF,而不需要下载下来再打开。客户端已经安装有PDF插件。

1. 在SharePoint2010管理中心-应用程序设置-常规处理-浏览器文件处理程序(BrowserFileHandling),设置为许可(Permissive),不添加标头,允许非office文档能够直接打开。

    结果在首站点没问题,有些子站点仍然只能下载。

2. 在首页网站集功能中,关闭“默认情况下,在客户端应用程序中打开文档” 

    设置完后,仍然不能在浏览器中打开,跟踪发现,以下标头仍然存在,正常的没有以下标头

    Content-Disposition:attachment; filename=XXXXX.PDF

    X-Download-Options:noopen

  

于是在http://www.pdfsharepoint.com/sharepoint-2010-and-pdf-integration-series-part-1/找到了终极解决方案,上述设置都无需改变

1 $webApp = Get-SPWebApplication http://localhost
2 If ( $webApp.AllowedInlineDownloadedMimeTypes -notcontains " application/pdf ")
3 {
4 Write-Host -ForegroundColor White " Adding Pdf MIME Type... "
5 $webApp.AllowedInlineDownloadedMimeTypes.Add( " application/pdf ")
6 $webApp.Update()
7 Write-Host -ForegroundColor White " Added and saved. "
8 } Else {
9 Write-Host -ForegroundColor White " Pdf MIME type is already added. "
10 }

后记:

MSDN 中描述:This property is ignored when the BrowserFileHandling property is set to Permissive

应用程序的BrowserFileHandling设置为Permissive后,将忽视AllowedInlineDownloadedMimeTypes该属性设置,

而我的测试结果确不是这样,不知道是不是SharePoint2010有BUG,刚刚打过SP1 :D。

 

 

转载于:https://www.cnblogs.com/dreamnan/archive/2012/04/28/2475450.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值