Created
March 13, 2015 12:17
-
-
Save wpsmith/484eb67652b3c928940d to your computer and use it in GitHub Desktop.
PowerShell: Add MIME type to SharePoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-SPAllowedInlineDownloadedMimeType{ | |
[CmdLetBinding()] | |
param( | |
[Parameter(Mandatory=$true, Position=0, ValueFromPipeLine=$true)] | |
[Microsoft.SharePoint.PowerShell.SPWebApplicationPipeBind]$WebApplication, | |
[Parameter(Mandatory=$true, Position=1)] | |
[string]$MimeType | |
) | |
process{ | |
$actualWebApp = $WebApplication.Read() | |
if ($actualWebApp.AllowedInlineDownloadedMimeTypes -notcontains $mimetype) | |
{ | |
Write-Host "Adding MIME Type..." | |
$actualWebApp.AllowedInlineDownloadedMimeTypes.Add($mimetype) | |
$actualWebApp.Update() | |
Write-Host "Done." | |
} Else { | |
Write-Host -ForegroundColor Green "MIME type is already added." | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-SPAllowedInlineDownloadedMimeType -WebApplication http://mywebapp -MimeType "text/html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment