Friday, July 20, 2012

Joel Oleson and Michael Noel were in Calgary

No a technical post…
If you have been following SharePoint Joel Blog, probably know about this.

The two SharePoint MVPs Superstars were in town! Joel and his family is visiting southern Alberta, it is the first time they come to Calgary. Michael Noel flew in to join for him for the Banff National Park tour; this is Michael second visit to Calgary after 27 years. These two travel bees have been to hundreds to countries and countless cities… We are very lucky that they actually put Calgary into their travel map :)

Both Michael and Joel dropped by and gave Calgary SharePoint Usergroup(Calspug) a great presentation. First 30 minutes, Michael was presenting SQL 2012 new feature – AlwaysOn, and how this feature has been further enhanced to support SharePoint and provide the highest server Service Level Agreement (SLA), this feature is also simple to set up and running in SQL 2012, I could see the great benefit of this feature for couple of my projects.

Then SharePoint Joel was presenting Social Intranets – The SharePoint and Yammer Evolution, he shown us the project he has been working on and how Yammer plug-in to SharePoint and plays an important role for collaboration, sharing content and search… With the recent news of Microsoft acquired Yammers, Joel offers some high level insight view of how Yammer will soon play a major in Microsoft stack.

Overall, a great session for the Calgary SharePoint User Group. Not too lengthy and straight to the point.

Another highlight was the “SharePints”! The opportunity to hang out with the superstars for the evening, and heard them sharing their personal and professional life. Down to earth, friendly, approachable and absolutely great people!
Bil Simser and Michael Noel

Jay O'Hara and Joel Oleson

Group picture
Nice to meet you guys! Enjoy your trip in Banff and Calgary!

Tuesday, July 10, 2012

Opening .Msg and .Pdf files in Browser


Challenge
We have a problem in our environment that .MSG file and .PDF documents will be prompt to download before you can open them…  Here are the screen shots that made the users mad! 


Option 1
The common solution is changing the Browser file handling from "strict" to "permissive"…
  • Go to Central Administration > Manage Web Applications > Your WebApp > General Settings
  • Change Browser file handling from "strict" to "permissive"

Unfortunately, it does not work for me.

Option 2
So I tried second approach, add the correct MIME type to IIS for both .msg files and .PDF files.
  • Start Internet Information Manager
  • Select the server node in the left pane, pick your web application.
  • in Right Panel, Open in the MIME Types settings, click add.
  • Enter .msg for file name extension and application/vnd.ms-outlook
  • Repeat for all front end servers


Then run the following script

##============================================================================##
## Allowed Inline Downloaded MimeType for .Msg (Outlook) and .PDF in IIS
## Version: 1.0
## Last updated: 7 July, 2012
## Description: This script add value in AllowedInlineDownloadedMimeTypes for
## .msg files and PDF files
## Reference: http://ianankers.wordpress.com/author/ianankers/page/2/
##==============================================================================#

## Add .Msg (Outlook file type)
$webApp = Get-SPWebApplication http://yourspweburl
If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains "application/vnd.ms-outlook")
{
  $webApp.AllowedInlineDownloadedMimeTypes.Add("application/vnd.ms-outlook")
  $webApp.Update()
  Write-Host "application/vnd.ms-outlook added to AllowedInlineDownloadedMimeTypes"
}

## Add .Pdf
If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains "application/pdf")
{
  $webApp.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
  $webApp.Update()
  Write-Host "application/pdf added to AllowedInlineDownloadedMimeTypes"
}

Well I have tried it and it does not work for me again…

Option 3 (Finally – This work!)
Third tried - Further investigation, it turned out that the web site was created using the previously saved template; the template was created when the web application had 'Browser File Handling' set to 'Strict'. So changing the 'Browser File Handling' in Web Application will have no effect on these sub sites.

The situation has pointed out exactly as Craig Lussier mentioned in his response in the Forums

So here is powershell script that should rescue you from the situation.
##============================================================================##
## PowerShell to Set the 'Browser File Handling' setting to 'Permissive'
## Version: 1.0
## Last updated: 7 July, 2012
## Description: This script will set BrowserFileHandling to "Permissive" for
## specific a document library
## Reference: http://ianankers.wordpress.com/author/ianankers/page/2/
##==============================================================================#

#Get Web
$web = Get-SPWeb "http://yourspweburl"

#Get Document Library
$docLib = $web.lists["Document Library"]

#View all properties/methods of the Document Library and you'll see that BrowserFileHandling is a property
$docLib | Get-Member

#See the current BrowserFileHandling setting for the Document Library
$docLib.BrowserFileHandling

#If you need to change it from Strict to Permissive
$docLib.BrowserFileHandling = "Permissive"
$docLib.Update()

After the executed the script, I clicked on the .Msg file, VoilĂ ! The "Open" button shows up, 

and when I clicked on the PDF, the browser simply open the PDF without a prompt.


Update: 12 Nov 2012, 
Just stumbled to NICO's blog, where he created a nice script and log the changes as well.
http://gallery.technet.microsoft.com/office/Change-Browser-File-e60b46c9

Here is the script

param  

[string] $URL, 
[boolean] $writeToFile = $true 

#Change Browser File Handling for all lists and libraries in SharePoint 2010 farm 
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue 

#Counter variables 
$webcount = 0 
$listcount = 0 

if($writeToFile -eq $true) 

$outputPath = Read-Host "Outputpath (e.g. C:\directory\filename.txt)" 


if(!$URL) 

#Grab all webs 
$webs = (Get-SPSite -limit all | Get-SPWeb -Limit all -ErrorAction SilentlyContinue) 

else 

$webs = Get-SPWeb $URL 

     
if($webs.count -ge 1 -OR $webs.count -eq $null) 

    foreach($web in $webs) 
    { 
    #Grab all lists in the current web that have the "Strict" Browser file handling 
    $lists = $web.Lists | ?{$_.BrowserFileHandling -eq "Strict"} 
    #If there are lists that have the strict browserfilehandling 
        if(-not(!$lists)) 
        { 
        Write-Host "Website"$web.url -ForegroundColor Green   
        if($writeToFile -eq $true){Add-Content -Path $outputPath -Value "Website $($web.url)"} 
            foreach($list in $lists) 
            {  
            #Change the browser file handling to permissive 
            $list.BrowserFileHandling = "Permissive"  
            $list.Update() 
            $listcount +=1 
            Write-Host " - "$list.Title updated           
            if($WriteToFile -eq $true){Add-Content -Path $outputPath -Value " - $($list.Title) updated"} 
            } 
    $webcount +=1 
    $web.Dispose() 
        } 
    } 
#Show total counter for checked webs & lists 
Write-Host "Amount of webs that were updated:"$webcount 
Write-Host "Amount of lists updated:"$listcount 
if($WriteToFile -eq $true){Add-Content -Path $outputPath -Value "Amount of webs updated:$($webcount)"; Add-Content -Path $outputPath -Value "Amount of lists updated: $($listcount)"} 

else 

Write-Host "No webs retrieved, please check your permissions" -ForegroundColor Red -BackgroundColor Black 
}

Well hope this help! Thanks!

Thursday, July 5, 2012

Disabled Content Organizer - SharePoint 2010

If Content Organizer is enabled in your site, you will see a "Drop Off Library" document library either in your left Nav or when you are in All Site Content.


Disabled the feature in Site Settings does not remove the library. and you can't simply delete "Drop Off Library" because the "Delete this document library" link is not available when you are in the "Library Settings"... so how to delete this library?

Here is the PowerShell script that should save your day.

Powershell Script:

##=======================================================================================##
## PowerShell Disabled Content Organizer and delete "Drop Of Library" 
## Version: 1.0
## Last updated: 30 June, 2012
## Description: This script will loop through all the subsites in site collection 
##  and disable the Content Organizer Feature then remove the "Drop off Library"
## Reference: http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/ff72703e-9ba0-4dc2-8221-ccda3529183d
##=======================================================================================##

if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
 Add-PSSnapin Microsoft.SharePoint.PowerShell;
}

Get-SPSite -Identity http://yoursitecollectionurl | Get-SPWeb -Limit ALL | ForEach-Object { 
  Disable-SPFeature –Identity DocumentRouting –url $_.Url –Confirm:$false
  $dropOffLibrary = $_.Lists["Drop Off Library"]
  $dropOffLibrary.AllowDeletion = "True"
  $dropOffLibrary.Update()
  $dropOffLibrary.Delete()
}

Hope this help!
Thanks