wlwmanifest.xml Options Documented

by Brian Brewder October 12, 2010 00:36

There are a ton of options for Windows Live Writer, unfortunately most of them are undocumented. I have compiled a list of options that are available in Windows Live Writer 2011.

I have not tried them all out, but I have added descriptions where I can. If you have additional information about any of these, let me know and I’ll update my post.

Option

Change to Writer

API changes

supportsPostAsDraft Enables the “Post draft to blog” button. publish parameter (last one) is set to false if publishing as a draft.
supportsFileUpload    
supportsExtendedEntries    
supportsCustomDate Allows the user to set the post date (“Set post date”). Post.dateCreated is set.
supportsCustomDateUpdate    
supportsHttps    
supportsCategories Shows the categories for the user to pick from for the post. See supportsCategoriesInline.
supportsCategoriesInline   If Yes, metaWeblog.getCategories is called. If No, mt.getCategoryList is called.
supportsMultipleCategories Allows the user to select multiple categories (checkboxes instead of radio buttons).  
supportsHierarchicalCategories    
supportsNewCategories Allows the user to enter new categories.  
supportsNewCategoriesInline   Includes new categories in Post.categories. If No but supportsNewCategories is Yes, new categories are set by calling wp.addCategory.
supportsSuggestCategories    
categoryScheme    
supportsKeywords Allows user to enter tags. If Yes and tags are entered, sets Post.mt_keywords.
supportsGetTags Determines whether the available tags can be fetched from the provider. If Yes, calls wp.getTags.
supportsCommentPolicy   If Yes, Post.mt_allow_comments is used.

0 - None - No comments allowed
1 - Open - Comments can be read and write 
2 - Closed - Comments can be read but not written

supportsPingPolicy    
supportsAuthor Allows the user to set the author of the post. Calls wp.getAuthors to get the list of authors. Sets Post.wp_author.
supportsSlug    
supportsPassword    
supportsExcerpt Allows the user to set the excerpt. Sets Post.mt_excerpt.
supportsTrackbacks    
supportsPages    
supportsPageParent    
supportsPageOrder    
supportsPageTrackbacks    
linkToSkyDriveSelfPage    
requiresHtmlTitles    
returnsHtmlTitlesOnGet    
supportsEmptyTitles    
supportsScripts    
supportsEmbeds    
supportsImageUpload    
defaultView    
characterSet    
requiresXHTML    
dhtmlImageViewer    
postBodyBackgroundColor    
maxCategoryNameLength    
supportsAutoUpdate    
invalidPostIdFaultCodePattern    
invalidPostIdFaultStringPattern    
templateIsRTL    
maxPostTitleLength If the title is over this number of characters, a message box will be displayed when they attempt to publish and the post cannot be published.  
homepageLinkText Display text for the link to the blog (under Blog Account tab, Shortcuts).  
adminLinkText Display text for the link to the admin console for the blog(under Blog Account tab, Shortcuts).  
adminUrl URL to the admin console(under Blog Account tab, Shortcuts).  
postEditingUrl    
postEditingUrlPostIdPattern    
imageEndpoint    
serviceName    
commentPolicyAsBoolean    
allowPolicyFalseValue    
maxRecentPosts    
contentFilter    
permalinkFormat    
postDateFormat    
fileUploadNameFormat    
useLocalTime    
supportsPostSynchronization    
trackbackDelimiter    
futurePublishDateWarning    
useSpacesTemplateHack    
useSpacesCIDMemberName    
usePicasaImgMaxAlways    
usePicasaS1600h    
keywordsAsTags    

Tutorial: Building a Windows Live Writer Provider in .Net

by Brian Brewder October 09, 2010 18:26

I am building my own blog engine for fun (I just want to learn how this all works) and figured I should start with support for Windows Live Writer since I wanted to make sure my database supported whatever structure Writer supported. This turned out to be a fairly challenging project so I decided I would write an article that walks through the steps of creating a basic provider to hopefully help other developers (and maybe future me Smile) get something up and running quickly.

First off, you should know that Writer uses a combination of MetaWeblog, Movable Type, and WordPress. These are all XML-RPC based APIs. In fact Writer can actually use subsets of these APIs so you can decide what you want to support. You can learn more about this on Microsoft’s site: Windows Live Writer Provider Customization API.

To make your life easier, you should download the Xml-Rpc.Net library created by Charles Cook. This library provides everything you need so you don’t need to worry about the Xml-Rpc protocol. You will just need to create a service with the right methods and the Xml-Rpc.Net library will handle the xml for you.

If you are building your service in .Net 4 you will want to make a change to the library before using it in your project or you might end up with a server error (I reported this to Charles so it might be fixed by the time you download the library). Basically you will want to apply SecurityCriticalAttribute to CookComputing.XmlRpc.XmlRpcFaultException.GetObjectData (src\XmlRpcFaultException.cs, line 76).

    [SecurityCritical]
    public override void GetObjectData

Sample Project

Once you’ve gotten the Xml-Rpc.Net library compiled and ready to go, you can now start creating your project. I’ve created an example project that you can use as reference for your project. The project was created from an empty web project in Visual Studio 2010 and was largely borrowed from Keyvan Nayyeri’s excellent article on this subject.

Download Example Project (look for the Download button)

If you prefer, you can just look at the code in the CodePlex repository, but you won’t be able to run it from there. The code does include a modified version of the Xml-Rpc.Net dll that works with this project.

The first file to look at in the project is the MetaWeblog.ashx file. This file is the common extension used to define a web handler. This one defines the backing class as LiveWriterExample.MetaWeblog.

The next file to look at is MetaWeblog.cs. This file contains the service contract interface IMetaWeblog and the class MetaWeblog (this is the class pointed at in MetaWeblog.ashx). All the methods on the interface have an XmlRpcMethodAttribute applied to them. The name provided is the name of the method as defined in the MetaWeblog API (this is the best reference for what Windows Live Writer supports).

The MetaWeblog class implements the IMetaWeblog interface. This is the critical code for you to modify if you want to create your own provider. Just look for the TODOs and change out the logic with your own.

The MetaWeblogStructures.cs file contains the code for the structures used as parameters and return values. Xml-Rpc.net automatically creates and populates the parameters from the xml being sent in and converts the return values into the correct Xml-Rpc response.

If you are wondering how Writer knows how to call into your provider, the answer starts in the Default.aspx file. The header of this file includes a link tag that defines the location of the RSD file. RSD stands for Really Simple Discovery which is an xml document that identifies what services are exposed by a website. The MetaWeblog node includes the url to the ashx file. The node also includes the id for the blog so if your blog engine supports multiple blogs, you will need to make this dynamic so that it returns the correct blogid.

The last file that we are going to look at is the wlwmanifest.xml file. This file contains Windows Live Writer specific configuration. It allows you to customize Writer to include features that your blog supports and exclude features it doesn’t. You can even include custom tools! Writer can find this file by either convention (eg, http://myblog.com/wlwmanifest.xml) or using a link tag in the blog page. Read Discovering and Downloading Manifest Files for more information. To keep things simple, the sample project removes almost all the options.

Running and Debugging the Project

To test the provider, simply run the project, copy the url, and use it to add an account to Windows Live Writer.

A few notes about debugging:

  • The sample project will accept any username and password, so no need to set one up.
  • Do not download the blog theme. This isn’t a blog engine, it is just the provider so there is no blog theme available.
  • The account doesn’t show up in Writer (at least not the version I have) until you restart Writer.
  • The sample project stores all the information in memory. Any posts that were created will be lost once you stop debugging the project.
  • If you are interested in seeing the raw xml, you can put a break point in the MetaWeblog.Invoke method. I modified the XmlRpcRequest object in the Xml-Rpc.Net library so that it contains the XmlDocument that is sent for the xml-rpc request.
  • Fiddler is a great way to see what requests Writer is making to your provider. However, if you are testing with localhost, you will need to slightly modify the url to your provider when adding the account. Instead of localhost:12345 (or whatever your port is), try localhost.:12345 (notice the dot after localhost). If you don’t include the dot, fiddler will not capture the traffic.
  • If the service is running but Writer cannot create an account, try adding a break on Exception for all exceptions.
  • I cannot figure out how to populate the Service Name in the account details. I verified that the node name in wlwmanifest.xml is correct.

Great Resources

This article is littered with resources that I have found invaluable for learning how to create my own blog engine. To make it easier to find them, I figured I should provide a nice ordered list.

Have fun writing the next greatest blog engine!Party smile

Powered by BlogEngine.NET 1.6.0.0

About the author

I've been a software developer since 1999 and have been working with .Net since 2002. I love creating software, playing with productivity tools, and improving the process of software development. I hope you enjoy my blog. Please feel free to leave comments or contact me, I would love to hear from you.