How to get Companyweb to work with Office 2007

Original Post From here:

A few people said this was a showstopper for them in recommneding Office 2007 to their customers so I figured it had to be fixed.  I nixed a huge amount of work from the right stuff blog “Office 2007 File Icons for Windows SharePoint Services 2.0 and SharePoint Portal Server 2003” and the script work from http://blogs.msdn.com/karstenj/archive/2006/01/03/508888.aspx.  The problems were: 1) no icons for files 2) file types not recognised by companyweb 3) downloads could not be opened as the file type was said to be a compressed file 4) could not edit from companyweb

OK, so here is the process.

1. Download the icons from here and put them into folder C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\IMAGES\ (read the item on the the right stuff to pick your files)

2. Update the C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\XML\docicon.xml file with the information below into the ByExtension section

<Mapping Key=”docx” Value=”docx.gif” EditText=”Microsoft Office Word” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”docm” Value=”docm.gif” EditText=”Microsoft Office Word” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”dotx” Value=”dotx.gif” EditText=”Microsoft Office Word” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”dotm” Value=”dotm.gif” EditText=”Microsoft Office Word” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”xlsx” Value=”xlsx.gif” EditText=”Microsoft Office Excel” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”xlsm” Value=”xlsm.gif” EditText=”Microsoft Office Excel” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”xltx” Value=”xltx.gif” EditText=”Microsoft Office Excel” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”xltm” Value=”xltm.gif” EditText=”Microsoft Office Excel” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”xlsb” Value=”xlsb.gif” EditText=”Microsoft Office Excel” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”xlam” Value=”xlam.gif” EditText=”Microsoft Office Excel” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”pptx” Value=”pptx.gif” EditText=”Microsoft Office PowerPoint” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”pptm” Value=”pptm.gif” EditText=”Microsoft Office PowerPoint” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”potx” Value=”potx.gif” EditText=”Microsoft Office PowerPoint” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”potm” Value=”potm.gif” EditText=”Microsoft Office PowerPoint” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”ppam” Value=”ppam.gif” EditText=”Microsoft Office PowerPoint” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”ppsx” Value=”ppsx.gif” EditText=”Microsoft Office PowerPoint” OpenControl=”SharePoint.OpenDocuments”/>
<Mapping Key=”ppsm” Value=”ppsm.gif” EditText=”Microsoft Office PowerPoint” OpenControl=”SharePoint.OpenDocuments”/>

3. Update the metabase MIME types by running the following script (copy it to a text file called update_mime.vbs and then double click on it – ONCE):

‘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
Const ADS_PROPERTY_UPDATE = 2

‘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/vnd.ms-word.document.macroEnabled.12″ , _
“.docx”,”application/vnd.openxmlformats-officedocument.wordprocessingml.document” , _
“.dotm”,”application/vnd.ms-word.template.macroEnabled.12″ , _
“.dotx”,”application/vnd.openxmlformats-officedocument.wordprocessingml.template” , _
“.potm”,”application/vnd.ms-powerpoint.template.macroEnabled.12″ , _
“.potx”,”application/vnd.openxmlformats-officedocument.presentationml.template” , _
“.ppam”,”application/vnd.ms-powerpoint.addin.macroEnabled.12″ , _
“.ppsm”,”application/vnd.ms-powerpoint.slideshow.macroEnabled.12″ , _
“.ppsx”,”application/vnd.openxmlformats-officedocument.presentationml.slideshow” , _
“.pptm”,”application/vnd.ms-powerpoint.presentation.macroEnabled.12″ , _
“.pptx”,”application/vnd.openxmlformats-officedocument.presentationml.presentation” , _
“.xlam”,”application/vnd.ms-excel.addin.macroEnabled.12″ , _
“.xlsb”,”application/vnd.ms-excel.sheet.binary.macroEnabled.12″ , _
“.xlsm”,”application/vnd.ms-excel.sheet.macroEnabled.12″ , _
“.xlsx”,”application/vnd.openxmlformats-officedocument.spreadsheetml.sheet” , _
“.xltm”,”application/vnd.ms-excel.template.macroEnabled.12″ , _
“.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)
Next

‘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
Loop

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

Set oExec = Nothing

‘Report status to user
WScript.Echo “SharePoint 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
MimeMapObj.SetInfo
End Sub

that did it for me 🙂

[updated]

Well, it almost did, in fact, when you tried to open a file by clicking on it, you only got a read only version.  Reading the KB article http://support.microsoft.com/kb/870853 I discovered this was deliberate and I changed it a bit for Office 2007 and now the following command run from an ELEVATED command prompt on the client will work.  You can also set Group Policy on the server to set this key too (just remember to change the 11 to a 12 if reading the KB article).

reg add HKCU\Software\Microsoft\Office\12.0\Common\Internet /v OpenDocumentsReadWriteWhileBrowsing /t REG_DWORD /d 01

Bad Behavior has blocked 194 access attempts in the last 7 days.