In SPS 2003, Use custom template to create the document workspace through ECB menu link.

In SPS 2003, In the ECB menu of the documents we get an option “Create Document Workspace”. This link uses the OOB document workspace STS#2 to create the document workspace. There was a requirement to use our own custom template to create the document workspace through this ECB menu link.


We started troubleshooting the issue by following the link in the ows.js. It navigates to the Createws.aspx and this page creates the document workspace using the STS#2 template implicitly. The code behind of the this page is existing in the Microsoft.SharePoint.ApplicationPages.DWSCreatePage and the STS#2 is hard coded in this class.

We can create a custom application page based on the Createws.aspx and implement the method to create a document workspace based on the custom template.

The method to implement in the custom Createws.aspx is as follows :

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using Microsoft.SharePoint; 

namespace CreateSite 
    public partial class Form1 : Form 
        public Form1() 

        private void button1_Click(object sender, EventArgs e) 
            if (CreateSite("<http://ms9:501/sites/501>", "test11", "test1", "tj.stp")) 
                MessageBox.Show("Not Done"); 

        public static bool CreateSite(string parentSiteURL, string siteURLRequested, string siteTitle, string siteTemplateName) 
            bool returnCondition = false; 
            const Int32 LOCALE_ID_ENGLISH = 1033; 

            using (SPSite siteCollection = new SPSite(parentSiteURL)) 
                SPWeb parentWeb = siteCollection.OpenWeb(); 
                SPWebTemplateCollection Templates = siteCollection.GetWebTemplates(Convert.ToUInt32(LOCALE_ID_ENGLISH)); 
                    false, false); 

                returnCondition = true; 
            return returnCondition; 


In MOSS 2007, you will have control over ECB menu of the document item so you can add or remove a link in it which can point to a new page. Right now in SPS2003, we have to modify ows.js to point it to a new page and then we are actually breaking the product. The implementation of the page which will create the document workspace from your template, will be almost similar in MOSS and SPS, code will be the same.

:: Please note that I would have just uploaded my initial code and you might want to consider proper optimization of the code and disposal of objects properly. I might not have updated the latest code here.

Comments (0)

Skip to main content