Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PowerShell: Add MIME type to SharePoint
function Add-SPAllowedInlineDownloadedMimeType{
[Parameter(Mandatory=$true, Position=0, ValueFromPipeLine=$true)]
[Parameter(Mandatory=$true, Position=1)]
$actualWebApp = $WebApplication.Read()
if ($actualWebApp.AllowedInlineDownloadedMimeTypes -notcontains $mimetype)
Write-Host "Adding MIME Type..."
Write-Host "Done."
} Else {
Write-Host -ForegroundColor Green "MIME type is already added."
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