This week I was playing around with the publishing console to add some quick access buttons.. as you might already know, the publishing console reads a xml file that is stored in the “_catalogs/masterpage/editing menu” folder called the “CustomQuickAccess”. And as you already may know, this folder get’s created and populated by the publishing feature so it’s pointless to overwrite this file by using feature to your deployment script by using a Module in your element file. And the only ‘proper’ way of populating this file in the folder is by using a FeatureReceiver that uploads the file to the folder. Up until this point there a some blogposts that cover this scenario.. but little to none (I couldn’t find it :) that cover the last part that is of vital importance.. being the encoding that is used for the file.
So let’s say you want something like this awesome looking console :
Then the .xml looks file a bit like this:
Version=184.108.40.206, Culture=neutral, PublicKeyToken=92517b51c027cdc9"
I did this using SPD and copying the .dll into the GAC and everything was working like a charm.. Next step was to make it deployable using a FeatureReceiver by uploading the .xml file.. not a big deal.. had done that many times.. so walk in the park right? WRONG!
So what went wrong you might wonder.. well.. every time I upload the file using a console application (for testing out my soon-to-be feature receiver) I encountered the following problem:
Console Configuration File Error: XML Exception: The specified node cannot be inserted as the valid child of this node, because the specified node is the wrong type.
First I thought it may had something to do with the method of uploading the file SPFile.SaveBinary() vs SPFiles.Add() .. but that wasn’t it. Then I looked back at previous projects and I noticed that in one project in particular I was doing the following :
ASCIIEncoding asciiEncoder = new ASCIIEncoding();
So next step was to reuse that piece of code and check if that would do the trick.. and as you may have guessed.. that indeed do the trick! :) I checked the Save setting of my file in the project and it was set to UTF.. I changed that to ASCII and voila .. it worked!
Make sure that you upload files using the ASCII file encoding otherwise SharePoint has problems with loading the files..