Adding Attachments to SharePoint blogs

While SharePoint 2007 does offer a blog-template, this is actually quite minimalistic. Even though you can usually add attachments to every list item in sharepoint, this is not possible for blog posts.

Well, actually, attachments are enabled for blog posts, and if you’re using an editor such as Windows Live Writer all images and files are being added as attachments to the current post. But this just isn’t possible if you’re stuck with the web-editor for writing new posts.

So I did some digging on what’s needed to get SharePoint to offer attachments for blog posts.

First of all you should be aware, that you’re going to modify some files dear and near to SharePoint – this might not always be the recommended way 🙂

OK, let’s get started. Since we already noticed that attachments are enabled on the list of posts, we somehow need to get this darn button in the toolbar to appear.

Since the blogging feature is built-in into SharePoint it’s view definition is found in the DefaultTemplates.ascx within the %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\Template\ControlTemplates. Within this file are a whole lot of Rendering-Templates defined. Based on the existing BlogForm Template I created my own Template called BlogFormExt.

<SharePoint:RenderingTemplate ID="BlogFormExt" runat="server">
        <SPAN id='part1'>
            <SharePoint:InformationBar runat="server"/>
            <wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbltop" RightButtonSeparator="&nbsp;" runat="server">
                        <SharePoint:SaveAsDraftButton Text="<%$Resources:wss,tb_saveasdraft%>" runat="server"/>
                        <SharePoint:PublishButton Text="<%$Resources:wss,tb_publish%>" runat="server"/>
                        <SharePoint:GoBackButton runat="server"/>
            <SharePoint:FormToolBar runat="server"/>
            <p><a href="javascript:UploadAttachment();">Attach Me!</a></p>
            <TABLE class="ms-formtable" style="margin-top: 8px;" border=0 cellpadding=0 cellspacing=0 width=100%>
            <SharePoint:ChangeContentType runat="server"/>
            <SharePoint:FolderFormFields runat="server"/>
            <SharePoint:ListFieldIterator runat="server"/>
            <SharePoint:ApprovalStatus runat="server"/>
            <SharePoint:FormComponent TemplateName="AttachmentRows" runat="server"/>
            <table cellpadding=0 cellspacing=0 width=100% style="margin-top: 10px;"><tr><td class="ms-formline"><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></td></tr></table>
            <TABLE cellpadding=0 cellspacing=0 width=100% style="padding-top: 7px"><tr><td width=100%>
            <SharePoint:ItemHiddenVersion runat="server"/>
            <wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbl" RightButtonSeparator="&nbsp;" runat="server">
                        <SharePoint:InitContentType runat="server"/>
                        <SharePoint:CreatedModifiedInfo runat="server"/>
                        <SharePoint:SaveAsDraftButton Text="<%$Resources:wss,tb_saveasdraft%>" runat="server"/>
                        <SharePoint:PublishButton Text="<%$Resources:wss,tb_publish%>" runat="server"/>
                        <SharePoint:GoBackButton runat="server"/>
        <SharePoint:AttachmentUpload runat="server"/>

Important are the two highligthed lines. The first line adds a link to display a dialog to upload an attachment, the orher line adds the actual code for the dialog and stuff.

OK, so now we habe our new layout in place, that allows us to add attachments to new posts. Next we need to alter our blog to make use of this new template definition.

So using SharePoint-Designer open up the blog and navigate got the posts list. Open up the NewPost.aspx and find the webpart-element in the code view. There should be a line like

<TemplateName xmlns="">BlogForm</TemplateName>

which you wand to edit to

<TemplateName xmlns="">BlogFormExt</TemplateName>

This will use our new template-definition instead of the build-in template view.

This is basically all you need to do – well you also might want to edit the EditPost.aspx to use a template which enables the upload of new attachments; but I leave that to you.

Oh – one final note: this enables uploading attachments to a blog-post, but the attachments are not automatically displayed for e.g. as a list of items in the end of the post. You will have to add the links to the attachments in your post manually!.

Strange behaviors in SharePoint deployment

Today I had some really strange experiences while deploying some SharePoint application using a custom build WSP file.

First, I tried to re-deploy an existing solution, but that didn’t seem to succed. At least my SharePoint site replied with a “Service unavailable” notice. So I though, I should retract the solution – maybe someting in my updated solution broke my SharePoint site.

So doing a

stsadm –o retractsolution –name myapp.wsp –allcontenturls –immediate

also just failed on me. So next I was stuck. I couldn’t neither delete the solution nor retry to retract the solution because everytime I got the message, that another job is currently retracting this solution. This is why I couldn’t do anything at the moment. But what now? It didn’t seem like the was any other job running.

So I gathered a list of all running deployments using

stsadm –o enumdeployments

and then

stsadm –o canceldeployment –id

to actually cancel the running deployment. After that I could issue

stsadm –o deletesolution –name myapp.wsp –force

This actually remove the solution – but I had to find, that this wasn’t the cause for my “service unavailable”. So all this for nothing!

The strange thing about that is, that only one out of a dozen websites was not working. Then it strike me – looking at the IIS admin I found, that the app-pool associated with this SharePoint site was stopped – restarting the app-pool solved my “service unavailable” immediately.

IFilter for TIFF

Windows Server 2008 R2 comes OOTB with an IFilter, which allow the indexing of TIFFs. During the indexing the IFilter performs an OCR to recognize the actual content of the TIFF for the index.

This combined with a corresponding scanner introduces a small-sized DMS, where you can scan paper based documents to a document-library and let them being index and thus fully searchable by SharePoint.

Modifiy any page within SharePoint

There is alway something new to discover. Usually when you want to edit a page in SharePoint you just hit “Website actions” “edit page”. But certain pages don’t offer to edit themself, such as the edit-form for list-items. So what?

Just append “toolpaneview=2” to the address of the currently visible page; and magically you’ll see the WebPart-Editor-Pane, which allows to edit the current page. This way you can literally edit every page in SharePoint.

December 2009 Cumulative Update Packages for SharePoint Server 2007 und Windows SharePoint Services 3.0

On January 29th 2010 the December Cumulative-Update for WSS and MOSS has been released.

The Changes for WSS can be found in

  • 977022 ( ) Description of the Windows SharePoint Services 3.0 Cumulative Update Server Hotfix Package (Sts-x-none.msp): December 15, 2009
  • 977731 ( )Description of the Windows SharePoint Services 3.0 hotfix package (Sts-x-none.msp, Wssmui-en-us.msp): December 15, 2009
  • 977732 ( ) Description of the Windows SharePoint Services 3.0 hotfix package (Wssmui-en-us.msp): December 15, 2009

and the changes for MOSS

  • 977023 ( ) Description of the Office SharePoint Server 2007 Cumulative Update Server hotfix package (Coreserver-x-none.msp): December 15, 2009
  • 977024 ( ) Description of the Office SharePoint Server 2007 hotfix package (Dlc-x-none.msp): December 15, 2009
  • 977028 ( ) Description of the Office Project Server 2007 hotfix package (Pjsrvapp-x-none.msp, Pjsrvwfe-x-none.msp): December 15, 2009

Seems like I need to create a new Slipstream-Setup.

Slipstream for SharePoint

Just in case you’re in the need to install SharePoint and you want to incorporate the latest updates into your install – there is a better way than installing SharePoint and then start wssv3sp2-kb953338-x86-fullfile-en-us.exe and officeserver2007sp2-kb953334-x86-fullfile-en-us.exe.

Using a slipstreamed install you can install all updates during the initial installation, thus saving you a lot of time you would have spend to install the updates otherwise.

  1. Copy the SharePoint installation CD onto a network share
  2. Download of SP2 for Windows SharePoint Services as well as Office SharePoint Server
  3. Extract SP2 for Windows SharePoint Services using the /extract switch to the Updates folder within the install-folder of the SharePoint CD (wssv3sp2-kb953338-x86-fullfile-en-us.exe /extract:[path to install-folder\Updates]).
  4. Extract SP2 for Office SharePoint Server using the /extract switch to the Updates folder within the install-folder of the SharePoint CD (officeserver2007sp2-kb953334-x86-fullfile-en-us.exe /extract:[path to install-folder\Updates]).
  5. Delete wsssetup.dll from the Updates folder, because this migth cause a conflict with svrsetup.dll.

The same way applies to cumulative updates. Important is to keep the chronological order of the updates (oldest first!) as well as to first apply WSS updates before MOSS updates. So you should first integrate the December CU for WSS and then the December CU for MOSS.

This can even be applied to Language-Packs.

  1. Download of the needed Language-Pack.
  2. Extract the Language-Pack using the /extract switch.
  3. Download of Language-Pack updates.
  4. Extract the Language-Pack updates using the /extract switch.
  5. Copy the extracted files from step 4 to the Updates folder within the extracted files of step 2.

Which version of SharePoint?

Update 29.04.2010: I added the latest CUs for February and April 2001. The download for the April CU doesn’t seem to be available yet, so I cannot provide any version numbers.

There are currently a lot of updates available for SharePoint (Services as well as Portal Server), like SP1, Infrastructure Rollup, SP2 and various cumulative updates. That makes it hard to keep up to date with the latest patch-level. This little table should give some overview:

Update Name owssvr.dll Microsoft.SharePoint.portal.dll
RTM 12.0.4518.1016 12.0.4518.1016
October public update (2007) 12.0.6039.5000 12.0.6036.5000
Service Pack 1 12.0.6219.1000 12.0.6219.1000
Post-Service Pack 1 rollup 12.0.6300.5000 12.0.6300.5000
Infrastructure Update (IU) 12.0.6320.5000 12.0.6320.5000
August Cumulative Update (2008) 12.0.6327.5000 12.0.6327.5000
October Cumulative Update (2008) 12.0.6331.5000 12.0.6331.5000
December Cumulative Update (2008) 12.0.6335.5000 12.0.6335.5000
February Cumulative Update (2009) 12.0.6341.5000 12.0.6341.5002
Service Pack 2 12.0.6421.1000 12.0.6420.1000
April Cumulative Update (2009) 12.0.6504.5000 12.0.6504.5000
June Cumulative Update (2009) 12.0.6510.5001 12.0.6507.5000
August Cumulative Update (2009) 12.0.6514.5000 12.0.6514.5002
October Cumulative Update (2009) 12.0.6520.5000 12.0.6520.5000
February Cumulative Update (2010) (WSS, MOSS) 12.0.6529.5000 12.0.6529.5000
April Cumulative Update (2010) (WSS, MOSS)    

To verify the version of SharePoint you’re running go to %CommonFiles%\Microsoft Shared\Web Server Extensions\12\ISAPI and look at the file-versions of owssvrdll and/or Microsoft.SharePoint.portal.dll.

To get detailed information about hwo to deploy updates for SharePoint, check the TechNet sites on Deploy software updates for Windows SharePoint Services 3.0 and Deploy software updates for Office SharePoint Server 2007.

Executing SharePoint commands on the prompt

The STSADM tool provided by Sharepoint offers almost all features, which are available through the central administartion of Sharepoint (if not more!). This is especially useful, if you’re scripting certain actions, so you can do massive changes to your Sharepoint environment in a save way.

But once in a while, when you’re issuing commands via STSADM you might notice that they seem not to be carried out right away. Especially when deploying Sharepoint Solution Packages (.wsp) this can lead to unexpected errors. Assume you add a solution to the solution-store of sharepoint and want to deploy that solution globally:

STSADM -o addsolution -filename mysolution.wsp
STSADM -o deploysolution -name mysolution -immediate

Looking at the solutions in the central administration might show ERROR. But why? What did go wrong? Central administration doesn’t offer any further clues.

To get to the root cause you have to know how Sharepoint is actually handling the commands issued via STSADM. These commands are being queued and then asynchronously processed. This processing is done by a corresponding service. In some circumstances this service might not be running – most likely because it’s set to start manually instead of automatic.

So switching this service from manual to automatic should do the trick. But to be really sure, that the commands are being processed you can instruct STSADM to execute all currently queued commands right now. This is useful for instance in the example shown above, where the second command can only be processed after the successful completion of the first. So the solution might look like this:

STSADM -o addsolution -filename mysolution.wsp
STSADM -o execadmsvcjobs
STSADM -o deploysolution -name mysolution -immediate

Show 'em all

When you’re working with Sharepoint workspace you might notice that you can create several instances in an meeting-workspace – one for each appointment.

Depending on the template you choose for your workspace, you can upload documents to a document-library in your workspace. These are manage individually for each appointment (aka instance).

Even though it seems as if there would be an individual document library per instance, this isn’t the case. Instead there is only one document library, which is being “filtered” according to the currently visible instance.

To get the content of all instance, all you have to do is to append &InstanceID=ALL to the URL of the list (or document library) and off you go!