Google Ads

Opening Office 2007 documents from the Companyweb in SBS2003

I recently encountered a problem where we couldn’t open documents using the new office file format when opening them from the Companyweb on SBS2003, and if I tried to save them it saved them as a zip file.

After a bit of research I narrowed it down to being mime entries being missing from iis manager, I assumed this is because we are running Sharepoint Services v2 which was part of the sbs install and you can’t upgrade to WSS3 from 2 but thats a different topic.

Anyway I managed to fix this by running this script on the server, paste this into notepad and save as 2007.vbs if you run this multiple times you will end up with multiple entries in your mime types.

‘This script adds the necessary Office 2007 MIME types to an IIS Server.
‘To use this script, just double-click or execute it from a command line.
‘Running this script multiple times results in multiple entries in the IIS MimeMap.

Dim MimeMapObj, MimeMapArray, MimeTypesToAddArray, WshShell, oExec

‘Set the MIME types to be added
‘ MimeTypesToAddArray = Array(“.manifest”, “application/manifest”, _
‘ “.xaml”, “application/xaml+xml”, “.application”, “application/x-ms-application”, “.deploy”, “application/octet-stream”, _
‘ “.xbap”, “application/x-ms-xbap”)
MimeTypesToAddArray = Array( _
“.docm”,”application/″ , _
“.docx”,”application/vnd.openxmlformats-officedocument.wordprocessingml.document” , _
“.dotm”,”application/″ , _
“.dotx”,”application/vnd.openxmlformats-officedocument.wordprocessingml.template” , _
“.potm”,”application/″ , _
“.potx”,”application/vnd.openxmlformats-officedocument.presentationml.template” , _
“.ppam”,”application/″ , _
“.ppsm”,”application/″ , _
“.ppsx”,”application/vnd.openxmlformats-officedocument.presentationml.slideshow” , _
“.pptm”,”application/″ , _
“.pptx”,”application/vnd.openxmlformats-officedocument.presentationml.presentation” , _
“.xlam”,”application/″ , _
“.xlsb”,”application/″ , _
“.xlsm”,”application/″ , _
“.xlsx”,”application/vnd.openxmlformats-officedocument.spreadsheetml.sheet” , _
“.xltm”,”application/″ , _
“.xltx”,”application/vnd.openxmlformats-officedocument.spreadsheetml.template” _

‘Get the mimemap object
Set MimeMapObj = GetObject(“IIS://LocalHost/MimeMap”)

‘Call AddMimeType for every pair of extension/MIME type
For counter = 0 to UBound(MimeTypesToAddArray) Step 2
AddMimeType MimeTypesToAddArray(counter), MimeTypesToAddArray(counter+1)

‘Create a Shell object
Set WshShell = CreateObject(“WScript.Shell”)

‘Stop and Start the IIS Service
Set oExec = WshShell.Exec(“net stop w3svc”)
Do While oExec.Status = 0
WScript.Sleep 100

Set oExec = WshShell.Exec(“net start w3svc”)
Do While oExec.Status = 0
WScript.Sleep 100

Set oExec = Nothing

‘Report status to user
WScript.Echo “Mime Types have been added.”

‘AddMimeType Sub
Sub AddMimeType (Ext, MType)

‘Get the mappings from the MimeMap property.
MimeMapArray = MimeMapObj.GetEx(“MimeMap”)

‘ Add a new mapping.
i = UBound(MimeMapArray) + 1
Redim Preserve MimeMapArray(i)
Set MimeMapArray(i) = CreateObject(“MimeMap”)
MimeMapArray(i).Extension = Ext
MimeMapArray(i).MimeType = MType
MimeMapObj.PutEx ADS_PROPERTY_UPDATE, “MimeMap”, MimeMapArray
End Sub

I found this on Microsoft Answers Credit for this must goto Brad_Saide

Comments are closed.