Subscribe: Chester's Blog
Added By: Feedage Forager Feedage Grade B rated
Language: English
manager  mcms manager  mcms  menuitems  net  new  posting  resource  service  size  system  version  via  web service  web 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Chester's Blog

Chester's Blog


Updated: 2018-03-19T04:45:08.403+08:00


Shell Extensions - Context Menu


I couldn’t blog for long time due to some personal reasons. Hope I’ll be able to blog without any breaks in future. I'm going to write something different this time, Context Menu for explorer.I wanted to write a context menu extension for the explorer using some Win32 API calls, which took me a while and it was really a pain. Had problems in debugging, needed to reboot the machine number of times, etc… So thought of coming up with a wrapper in .NET. The wrapper is mainly an abstract class which can be driven to create a personalized context menu extension. The assembly can be downloaded from here and the source can be downloaded from here.How To use Utils.ShellExtensions.ContextMenu.dllDeploy Utils.ShellExtensions.ContextMenu.dll in gac. Create a class library project. Add Utils.ShellExtensions.ContextMenu.dll to your project. Drive a class from BaseContextMenu. Make it com visible, install it in gac and register it for com.Example[ComVisible(true), Guid("0056DA96-FFD6-4180-BAB2-8C9B6F552B2D")]public class MyMenu : BaseContextMenu{     [ComRegisterFunction]     public static void RegisterFunction(Type t)     {          //Register for files          RegisterContextMenu.Register("*", t.GUID);          //Register for folders          RegisterContextMenu.Register("Directory", t.GUID);          //Register for drives          RegisterContextMenu.Register("Drive", t.GUID);     }     [ComUnregisterFunction]     public static void UnregisterFunction(Type t)     {          RegisterContextMenu.Unregister("*", t.GUID);          RegisterContextMenu.Unregister("Directory", t.GUID);          RegisterContextMenu.Unregister("Drive", t.GUID);     }     public override void AssembleMenu()     {          System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(@"c:\test.bmp");          System.Drawing.Bitmap bmp1 = new System.Drawing.Bitmap(@"c:\test1.bmp");          MenuItems menuItems1 = new MenuItems("Test1",0,false);          MenuItems menuItems2 = new MenuItems("Test2",1,false,bmp,true);          MenuItems menuItems3 = new MenuItems("Test3",2,false,bmp1,false);          menuItems2.Click +=new Utils.ShellContextMenu.MenuItems.MenuClickHandler(menuItems2_Click);          menuItems3.Click +=new Utils.ShellContextMenu.MenuItems.MenuClickHandler(menuItems3_Click);          //This order is important. Always insert the parent container and then the child!          InsertMenu(menuItems1);          AddMenu(menuItems1, menuItems2);          AddMenu(menuItems1, menuItems3);     }     private void menuItems2_Click()     {          System.Windows.Forms.MessageBox.Show("Menu Test2 clicked");     }     private void menuItems3_Click()   [...]

MCMS Manager 6.2


This release is for users who want MCMS Manager to be worked with .NET framework 2.0. Also from the previous version, MCMS Manager works with MCMS 2002 SP2. In future if necessary otherwise there wont be any releases for .NET framework 1.1 (I'm really struggling to manage my time).

Get the new version from here. For more information check MCMS Manager Site. Please don't forget to post your feedbacks.

MCMS Manager 6.1


After a while.. This version includes,

1. Adding Resource(s).
2. Windows Authentication support.
3. Authentication for the web service & more.

Get the new version from here. For more information check MCMS Manager site. Please don't forget to post your feedbacks here.

MVP for Microsoft Office Content Management Server (MCMS)


I got a mail (not email - parcel - with certificate) from Microsoft stating that I got awarded as MVP for MCMS!

I want to thank Stefan, Spancer, Mei Ying, Andrew, Angus and Jole Ward for their guidance! Surely I couldn’t have made it this far without their help.

The underlying connection was closed: An unexpected error occurred on a receive. (Web Service)


We had a web service which was working without any problem for few months and suddenly last week it started to give the above mentioned error. Even though I found some similar threads on the web, nothing helped me to solve the problem.

After few hours of R&D I found a workable solution! Overriding the web service's proxy class fixed the error where I’ve created a new HttpWebRequest.

protected override System.Net.WebRequest GetWebRequest(Uri uri)
//Get a new HttpWebRequest
System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(uri);
webRequest.KeepAlive = false;
return webRequest;

Where am I Now?


For last couple of months I was very busy with my new job (if you are not aware, currently I’m in Singapore and working for Sonopress Pvt Ltd) and couldn’t concentrate on maintain my blog as well as MCMS Manager.

Now I’m somewhat settled and also playing Lead role ;). I should thank Ananth (my lead) for recognizing me within this short period of time and recommending my name for the above mentioned position!

I’m sure that I’ll start my routine work very soon… (Surely there will be a release on MCMS Manager within couple of weeks!).

Spencer's Article Series on 'ASP.NET 2.0 and MCMS 2002 SP2'


Via Spencer:

With the recent release of Service Pack 2 for MCMS, it is now
possible to take advantage of many ASP.NET 2.0 features within your
MCMS applications. The ASP.NET 2.0 AdRotator control has been enhanced to
allow for programatic population, which makes it much easier to produce a
AdRotator using MCMS Resource Gallery Items.
[Read More]
With the recent release of Service Pack 2 for MCMS, it is now
possible to take advantage of many ASP.NET 2.0 features within your MCMS
applications. One the best new features introduced with ASP.NET 2.0 is Master
Pages, which allow developers to enforce common layout and behaviour across
pages within an application. Whilst at first pass many Master Pages concepts are
similar to those of MCMS, there are a number of benefits to be gained by taking
advantage of Master Pages within MCMS applications.

MCMS Manager 6.0


This version includes,

1. Incremental Export/Import & User Backup/Restore
2. Resource hit Statistics
3. Extended Search

Get the new version from here. For more information check MCMS Manager site. Please don't forget to post your feedbacks here.

Modifying Resource Browser to Display Thumbnail for Bitmaps


The Resource Browser (Web Author - Resource Manager) ships with MCMS doesn't provide a thumbnail preview for bmp files. That is acceptable as bmp is not a web image format. But if you are interested in showing a thumbnail for bmp files, it can be done via a customized Resource Manager.

1. Create a class inheriting Microsoft.ContentManagement.WebAuthor.ResourcesBrowse
a) Create a class library.
b) Body of the class -

using System;
using System.Drawing;
using Microsoft.ContentManagement.WebAuthor;
using Microsoft.ContentManagement.Publishing;

namespace MCMS
public class CustomResourceBrowser : ResourcesBrowse
public CustomResourceBrowser()

//Create a new method to hide the default DataBindResourceColumnThumbnailUrl
protected new string DataBindResourceColumnThumbnailUrl(object dataitem)
Resource resource = (Resource)dataitem;
string url = string.Empty;
IntPtr Missing = IntPtr.Zero;
using(Image image = Bitmap.FromStream(resource.OpenReadStream()))
using(Image thumbImage = image.GetThumbnailImage(32,32,null,Missing))
url = "http://WebPath/"+resource.Name;
url = resource.UrlThumbnail;
return url;

2. Add the following references
a) using System.Drawing
b) System.Web
c) using Microsoft.ContentManagement.WebAuthor
d) using Microsoft.ContentManagement.Publishing

3. Create a temporary folder with appropriate rights for a web user to write data to that. Have the folder in a saver place as it can be assessed by anyone. Make it as a virtual directory. In the PhysicalPath above class replace it with the path of this directory and WebPath with the virtual directory name.

4. Deploy the dll in the bin folder of your MCMS project.

5. Make a copy of ResourcesBrowse.aspx - its default location "C:\Program Files\Microsoft Content Management

6. Open ResourcesBrowse.aspx in notepad and change the Page derivative as bellow
<%@ Page language="c#" Codebehind="ResourcesBrowse.aspx.cs" SmartNavigation="true" AutoEventWireup="false"
Inherits="MCMS.CustomResourceBrowser" %>

This will make thumbnail in the temporary folder for bitmap files, which will be referred by Resource Manager - used to show the preview.

Note: Take precautions before using this method as ResourcesBrowse.aspx may get changed without any notification.

MCMS Manager Site Updated


I’ve updated the MCMS Manager site. Hope all of you will like the new look!

Rational Guide to installing MCMS 2002 Service Pack 2


Via Spencer :

This article provides a step by step installation for MCMS SP2, including the
developer tools for VS.NET 2005, SQL Server 2005, development gotchas and
upgrading the WoodgroveNet sample site.

Rational Guide to installing MCMS 2002 Service Pack 2

MCMS Manager 5.3


This version includes,

1. Placeholder content Find and Replace
2. Template switching
3. Save search (postings/resource) result in CSV format

Get the new version from here. For more information check MCMS Manager Site. Please don't forget to post your feedbacks.

A Web service to create Postings


There can be situations where the only solution to access MCMS is via web services. KB 327750 (How to use an MCMS Web service to ...) can be used as a starting point on creating a web service for MCMS. This article explains how a posting can be created using a web service (only the web method is provided).[WebMethod]public bool CreatePosting(string userName, string password, string channelGuid, string postingName, string templateGuid, out string error){    //The above parameter list can contain more information about the posting such as display name, placeholder content, etc.    //It is always recommended to encrypt the password and decrypt it.    //Usually error will be very much useful to get the exact problem form MCMS.    error = "";    bool postiongCreated = false;    try    {        using(CmsApplicationContext cmsContext = new CmsApplicationContext())        {            //Authenticate the context in update mode            cmsContext.AuthenticateAsUser(userName, password, PublishingMode.Update);            //Get the channel object            Channel parentChannel = cmsContext.Searches.GetByGuid(channelGuid) as Channel;            //Get the template object            Template sourceTemplate = cmsContext.Searches.GetByGuid(templateGuid) as Template;            //To check whether they are found or not. If necessary it can be separated            //to two conditions            if(parentChannel!=null && sourceTemplate!=null)            {                //Can this user create a posting/this template can be used to create posting?               //If necessary it can be separated to two conditions                if(parentChannel.CanCreatePostings && sourceTemplate.CanUseForAuthoring)                {                    try                    {                        Posting newPosting = parentChannel.CreatePosting(sourceTemplate);                        //More information can be set here if available.                        newPosting.Name = postingName;                        //Commit the changes      &[...]

MCMS Manager 5.2


In this release,

1. Improved version of Posting Size Checker
2. Improved version of Log generator
3. Resource gallery size check and more...

Get the new version from here. For more information check MCMS Manager site.

MCMS Manager 5.1


This release includes,

1. Posting Size Checker - a new tool to check the size of Postings
2. UI Improvements
3. Channel level Posting Submit/Approve

Get the new version from here. For more information check MCMS Manager site.

Maximum uploadable size of a Resource to Resource Gallery


Resource can be uploaded to resource galleries via Site Manager as well as via Resource Manager (web author). The size of the resource file which can be uploaded via Resource Manager can be changed by modifying the httpRuntime attribute in the relevant web.config file (a sample for that with explanation can be found here – MCMS faq).Site Manager uses underlying ASP service to interact with MCMS server. So to change the upload resource size via Site Manager, some modification should be done in the IIS MetaBase.xml/service depending on Maximum size. If the maximum size is less than 100000 bytes, follow Step 1. Otherwise follow Step 2.Step 1 - To restrict the size less than 100000 bytes:Open MetaBase.xml file – this can be found in \system32\inetsrvGo to Set the AspMaxRequestEntityAllowed to required maximum size – it should be in bytes and less than 100000 bytes.Stop the IIS (iisreset /stop).Save MetaBase.xml(before saving, make a copy of that file).Now start the IIS (iisreset /start).Step 2 - To restrict the size more than or equal to 100000 bytes:Asp service (Site Manager uses this to interact with MCMS Server) counts 100000 bytes as a chunk. So if the size is 100000 bytes or more, it will be divided in to 100000 byte chunks, so it will get uploaded without the maximum limit boundary which can be specified in Step1 – to avoid this must validate this in asp service.Open resupload.asp in notepad – it can be found in \Server\IIS_NR\System\ResUpload – have a copy of it before doing any modification.WriteFile function should be modified. Add the code(bold) given below before the creation of “AEBinFile.AEBinFile.1” object.……………if len(strFileExt)=0 thenResponse.Endend ifDim maxSizemaxSize = 1000000 ' maximum size of upload specified in MetaBase.xmlnCount = Request.TotalBytesif nCount > maxSize thenResponse.Status = "500" 'Some error....Response.Endend ifSet BinFile = Server.CreateObject("AEBinFile.AEBinFile.1")…………Note: As modifying resupload.asp is not supported, take precautions before using the 2nd method.[...]

MCMS Manager 5.0


This release includes,

1. Posting Comparer (new tool) - can compare postings/posting revisions
2. Resource Properties Editor - to edit Resource Properties
3. XML Editor - to edit XmlPlaceholder content

Get the new version from here. For more information check MCMS Manager site. Please post your feedbacks!

MCMS Manager Performance Test (Initialization)


Performance test for MCMS Manager was done with Search enabled (otherwise it must not take more than 5 sec to initialize).

Machine Configuration

Processor - Intel Pentium 4 Mobile CPU 1.80GHz
RAM - 256MB
O/S - Windows 2003

MCMS Configuration

Postings - 2982 (size - 8.5mb)
Resources - 50 (size - 0.5mb)
Templates - 20 (size - 0mb)

Total Application Size 9.0mb (here size is the size of objects generated by MCMS Manager).

Web Service (in the same machine) took 117.7800 Sec to initialize where as Local API took 72.7053 Sec.

Accessing Postings via HttpWebRequest/WebClient


After the post - Using CompareHTML to compare postings , few people asked me - how to access postings via WebClient.

Normally when we try to access posting via HttpWebRequest/WebClient, it will return "The remote server returned an error: (500) Internal Server Error."

The reason for the 500 server error is that authoring with MCMS is only supported with IE. And IE will always send the user agent string. So the code in WebAuthor requires this user agent string and does not check for this. As access with a user higher as subscriber is always treated as authoring the problem the above error will occur (thanks Stefan – for giving the correct reason!).

To avoid the above error when accessing a posting with a higher role than subscriber, it is required to specify the “User Agent”.

Via HttpWebRequest
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("url of the posting");
NetworkCredential networkCredential = new
httpWebRequest.Credentials = networkCredential;
httpWebRequest.UserAgent = "Mozilla/4.0+";
//UserAgent should be specified before getting the response.
HttpWebResponse webResponse = (HttpWebResponse)httpWebRequest.GetResponse();

Via WebClient
WebClient webClient = new WebClient();
NetworkCredential networkCredential = new
webClient.Credentials = networkCredential;
//User-Agent should be specified in header before getting the response.
Stream webStream= webClient.OpenRead("url of the posting");

MCMS Manager 4.4


This version includes,

1. UI enhancements.
2. Mei Ying's HyperLink Dependency Report Generator - I've made some modifications to fit MCMS Manager.
3. Disabled Search - so that if search is not necessary, it can be disabled - will increase the performance of MCMS Manager.

It can be downloaded from here. For more information check MCMS Manager Site.

Using CompareHTML to compare postings


CompareHTML is a component which ships with MCMS which can be used to compare two postings. This blog explains how it can be used to compare two postings. It can be extended as needed.

Add a reference to CompareHTML.dll. Also your class must have reference to System.Net, System.IO, and COMPAREHTMLLib.

The code piece given below contains the part which can be used to compare two postings. As it is simple and self explanatory, I’m not going to walk through that.

//Web client is used to get the content from the server
using(WebClient webClient = new WebClient())
NetworkCredential networkCredential = new NetworkCredential("username","password","domain");
webClient.Credentials = networkCredential;
string firstPosting = "";
string secondPosting = "";
using(Stream networkStream = webClient.OpenRead("first posting's url"))
using(StreamReader streamReader = new StreamReader(networkStream))
firstPosting = streamReader.ReadToEnd();
using(Stream networkStream = webClient.OpenRead("second posting's url"))
using(StreamReader streamReader = new StreamReader(networkStream))
secondPosting = streamReader.ReadToEnd();
//This is from CompareHTML.dll, which will compare both the content.
Compare postingCompare = new CompareClass();
string comparedPosting = postingCompare.CompareBuffers(firstPosting,secondPosting,false);
string pathDiffFile = "a place to save the compared html file";
using(StreamWriter streamWriter = new StreamWriter(pathDiffFile))
//This is to open the created html file.

Note : As CompareHTML.dll is not documented, take precautions before using it as it may change at any stage without any notification. Also reverse engineering CompareHTML is a license violation!

MCMS Manager 4.3


This version includes

1. Posting Revert.
2. Resource Replace.
3. Multiple posting Approve, Submit, decline etc...

Download the newer version of MCMS Manager from here. Please post your feedbacks.

MCMS Manager 4.2


I've got plenty of feedbacks on ‘slowness’ of the current version of MCMS Manager compared with old ones. So, in this version I’ve used zip-compression to reduce the time taken for response. I hope this will be faster than the old one.

Also with MCMS Manager 4.2, ‘Local MCMS API’ can be directly accessed by leaving the web service part in the login form blank. This will be surely faster than via web service. Go to MCMS Manager Site and download the new version. Please post your feedbacks!