Blogging from Microsoft Word
Like I mentioned in my first post I prefer to limit the number of applications that are installed but more importantly running at any given time. Despite dual core processors and multi gigabyte hard disk drives it seems to me the more we have the more "stuff" we find to use up all that power. Anyways long story short, I like to be able to do my blogging from stuff I already have rather than using something like Live Writer or worse still something that is online only which defeats my ability to blog when stuck at the airport or on a plane waiting for a ground stop at Chicago to clear up. Anyways Word 2007 has this cool new feature that supports blogging to Community Server (which I use) and other blogs that implement the MetaWebLog API spec. You get the ability to post to your blog while still having all the editing and layout tools that Word 2007 has to offer (like SmartArt for instance).
Anyways, my first blog post went about fine from Word and I was all good. Now came the second post and I decided that to make my point I needed some pictures. So I looked through the blog configuration options in Word to see how I can get these uploaded automatically. Now for some history, turns out when this feature was built into Word (and from what I hear it was a last minute add-on), Community Server did not support the full MetaWebLog API - specifically support was lacking for the newMediaObject which allows you to upload media files such as images and videos as part of your blog post. Since then this support has been added but it was probably too late in the Office 2007 release cycle to be able to update the Word feature. What all this means is that when you select Community Server as your blog provider you only have three options with regards to media files:
- Don't upload them through Word and do it on your own
- Upload them using FTP (requiring you to upload you credentials in the Manage Accounts dialog in Word 2007
- Use WebDAV
Now personally I don't like any of those three options perhaps most so because hey my blog does support newMediaObject so I have to make it work! So here's a screencast of how I finally got it to work:
Key things to note:
-
Don't use Community Server as your blog provider (I know you are on Community Server, just trust me)
-
Leave the images selection as "My Blog Provider"
-
Don't use spongebob / squarepants as your username and password J
Ok so we are almost done but not quite! Turns out I now ran into a different issue. Even with this configuration I was still having the post fail with Word complaining that the post was successful except that my images could not be posted. So fired up Google to do some research. Even posted to the Community Server forums but no response. Some more Googling finally pointed me to this which definitely seemed related. As the author of that post did, I quickly fired up my web application proxy (Fiddler and Paros) and right enough he was spot on. Sniffed the error messages back using Ethereal and it complained about a type mismatch. Checked with some folks at Microsoft and quickly confirmed this to be a bug. Now I had come this far and would be dammed if I were going to give up.
Paros has a neat little feature that lets you replace parts of the HTTP request or response header / body but me being me that would way too easy. Besides I have been wanting for a while to understand how Fiddler Scripts work. So when into Fiddler and hit "Customize Rules" under the Rules menu and that dropped me into the nice syntax highlighting enabled FiddlerScript Editor. Once there all it took was a few lines of code for me to replace the string type with an integer in the newMediaObject web service call. Here's the code (with the lines I added in italics):
|
public static RulesOption("&Workaround Word Blog Posting Bug")
var m_WorkaroundWordBlogPosting: boolean = false;
...
static function OnBeforeRequest(oSession:Fiddler.Session)
{
if ((null!=bpRequestURI) && (oSession.url.indexOf(bpRequestURI)>-1)){
oSession["x-breakrequest"]="uri";
}
...
if (m_WorkaroundWordBlogPosting && oSession.host == "www.codesecurely.org") {
oSession.utilReplaceInRequest("<int>my_blog</int>", "<string>my_blog</string>");
}
} |
This gave me a nice little menu option under Rules that I can easily turn on and off and which will workaround the bug nicely and geekily if you will! Couple of things to note if you want to use this script, don't forget to change "my_blog" to whatever your blog is called. So now each time I want to post to my blog I fire up Fiddler, check my shiny new option under the Rules menu and then click Publish in Word.
(Hopefully this works for videos too – well we'll know soon enough, won't we? Let's hope the video above makes it! – bad news is it doesn't – I guess only images work for now which is fine since it tackles my most common use case but let's see if any geekery can help deal with videos!)