Skip to main content

Developer's Guide to Windows SharePoint Services 3.0

Go Search
Home
  
Developer's Guide to Windows SharePoint Services 3.0 > Ask the Author > Todd, before I waste any more of my time, is this even possible  

Ask the Author

Modify settings and columns
  
View: 
Started: 3/1/2007 3:53 PM by
Todd, before I waste any more of my time, is this even possible?
First off, I'd like to say that SharePoint is the most unintuitive, craptastic technology I've ever had the displeasure of using.
 
That said, is this even possible:
I want to create a site definition, where when a user (from either Central Admin or an end-user creating a sub-site) creates a site:
1.  2 calendars, 2 lists, and 2 document libraries are created
  a.  All of the above are renamed
  b.  All of the above show up on the quicklaunch
 
2.  There are no default webparts on the default.aspx page:  Announcements, Image, Calendar, and Links.  I don't want any of those there.
  a.  In their place, I have a Contacts list in the left webpartzone, an Announcements list in the left webpartzone, and two link lists in the right webpartzone: 1 is for public links and 1 is for private.
     1.  The public links webpart is prepopulated with entries.
 
I've only found bits and pieces to the above problem in your book and from the internet, but, as usual, since we are talking sharepoint, the information is sparse.
 
Thanks in advance,
About to Quit Sharepoint Developer
Edited: 3/2/2007 12:34 AM by Todd Bleeker
SharePoint Developer,
 
Just so you know, I didn't write SharePoint (WSS v3). That said, I personally think that WSS v3 is tremendous step forward for .NET developers. To me it represents Microsoft's version of Web 2.0 today. But, of course, you are certainly entitled to your own opinion.
 
I have created a Todd Site Definition (see screen shot below) for you, "where when a user (from either Central Admin or an end-user creating a sub-site) creates a site", the following eight lists are automatically provisioned (I didn't have a more specific name for the calendars and libraries so I used 1 and 2 as suffixes):
 1. Calendar 1
 2. Calendar 2
 3. Contacts
 4. Announcements
 5. Library 1
 6. Library 2
 7. Public Links
 8. Private Links
 
I assumed that you wanted a Contacts list called Contacts and an Announcements list called Announcements for the "2 lists". The first six lists are automatically added to the Quick Launch bar but the two Links lists are not (they are only shown as List View Web Parts on the home page, as requested).
 
The Web Parts on the default.aspx page have been changed to:
 1. Contacts list in the left Web Part Zone
 2. Announcements list in the left Web Part Zone
 3. Two link lists in the right Web Part Zone
      One for public links (pre-populated with two link entries)
      The other for private links
 
I even included some of my "best practices" for custom site definitions like including an alternate CSS and JS file, using a custom Master Page, and a custom RESX file.
 
All of this has been packaged into a WSS Solution Package (WSP) CAB solution. Download this file, unzip it, and rename it with a CAB extension; then double click on it to see the contents. Don't forget to rename it back with a WSP extension. You can then deploy this WSP into the WSS v3 Solution Store using the following steps:
 1. Download ToddSiteDefinitionWSP.zip.
 2. Unzip it on your SharePoint Web Front End server in a "c:\wsp" directory (you will probably have to create this directory, it isn't special but I used this location in the next step).
 3. Install the WSP CAB into the SharePoint Solution store using the following stsadm command:
      stsadm -o addsolution -filename "c:\wsp\Todd Site Definition.wsp"
Note: stsadm commands must run from the BIN directory of the 12 Hive.
 4. Deploy it to your entire SharePoint Farm using the following command:
      stsadm -o deploysolution -name "Todd Site Definition.wsp" -immediate
Note: This can also be done thru SharePoint 3.0 Central Administration Operations Manage Solutions link.
 5. Begin to create a new WSS v3 site; after providing a Title and URL Name, choose the Custom tab in the Template Selection section and select Todd Site Definition.
Todd Site Definition Create

 6. Click Create.
 7. The new site should look very similar to the site you requested:
Todd Site Definition
 
If you would like to tweak the code that created this WSP CAB, you can download my VS.NET 2005 project.
Todd Site Definition Solution
 
Use the following steps to unpack and deploy it into your developer environment (I'm assuming that you are developing on a standalone Windows Server 2003 box with WSS v3 and VS.NET installed). As you'll see, my approach to building custom site definitions has evolved since I wrote the chapter for the book.
 1. Download ToddSiteDefinition.zip, the VS.NET project.
 2. Unzip it into My Documents\Visual Studio 2005\Projects on your developer VPC. It will create a ToddSiteDefinition subdirectory containing the VS.NET solution.
 3. Open the ToddSiteDefinition.sln file to see the project's contents.
 4. View the post Build Events from the Project's Properties.
 5. Notice that I am both copying the files to the appropriate location in the 12 Hive AND using MakeCAB to create the WSP CAB in "c:\wsp" (this may be remarked out with REM, if that is the case just remove the REM and the WSP CAB will once again be created).
 6. Replace "SharePointAppPool" with the Application Pool that your SharePoint Web Application is using. If you are unsure of your Application Pool, be sure to run IISReset after step #7.
 7. Build the VS.NET project; this copies the custom site definition files to the 12 Hive, recycles "SharePointAppPool" Application Pool, and builds the WSP CAB in "c:\wsp".
 8. If you didn't change the application pool in step #6, run IISReset from any command prompt.
 9. Begin to create a new WSS v3 site; after providing a Title and URL Name, choose the Custom tab in the Template Selection section and select Todd Site Definition (see image above).
10. Click Create.
11. Again, the new site should look very similar to the site you requested.
12. To make alteractions: Change the files in the VS.NET project, recompile using Ctrl-Shift-B (or whatever keystrokes you like), and create a new site to see your changes. Changes to some elements like pages do not require the recreation of a site, but all changes to the ONET.XML do require the recreation of a site).
 
It took longer to write this response than it did to code and test the custom site definition. All in all I spent roughly 30 minutes on this response.
 
HTH,
 
<Todd />
 

From:
Posted: Thursday, March 01, 2007 3:53 PM
Subject: Todd, before I waste any more of my time, is this even possible?

First off, I'd like to say that SharePoint is the most unintuitive, craptastic technology I've ever had the displeasure of using.
 
That said, is this even possible:
I want to create a site definition, where when a user (from either Central Admin or an end-user creating a sub-site) creates a site:
1.  2 calendars, 2 lists, and 2 document libraries are created
  a.  All of the above are renamed
  b.  All of the above show up on the quicklaunch
 
2.  There are no default webparts on the default.aspx page:  Announcements, Image, Calendar, and Links.  I don't want any of those there.
  a.  In their place, I have a Contacts list in the left webpartzone, an Announcements list in the left webpartzone, and two link lists in the right webpartzone: 1 is for public links and 1 is for private.
     1.  The public links webpart is prepopulated with entries.
 
I've only found bits and pieces to the above problem in your book and from the internet, but, as usual, since we are talking sharepoint, the information is sparse.
 
Thanks in advance,
About to Quit Sharepoint Developer
Posted: 3/6/2007 2:58 PM by
Todd,
Thank you for the write-up and the files.  I regret starting the thread the way I did.  As you could probably tell, I was at wit's end with SharePoint on that day, especially once I started trying to accomplish what you did in so little time.
 
In the future, I'll be sure to post when not angry =)
 
P.S. - I'm still not what would be called a SharePoint fan, but since it's my job, I have to "live" with it.  Hopefully I will be sold on it before I pull out the rest of my hair.
Posted: 5/8/2007 10:10 PM by
Hi Todd,
 
Thanks for redoing the example, I was able to get much further with this.  I am getting an error however when I try to create the site (Step 10 below, under the ToddSiteDefinition.zip VS.NET).
 
Can you shed any light on this one? here it is:

Failed to instantiate file "default.master" from module "DefaultMasterPage": Source path "default.master" not found

Thanks again,
Paul
Posted: 5/9/2007 10:17 PM by
If there is an answer to my earlier question ( what is: Failed to instantiate file "default.master" from module "DefaultMasterPage": Source path "default.master" not found?)  I'd like to know what it might be for troubleshooting purposes in future. 
 
However, I tossed the example in Chap 6 and just repeated the ToddSiteDefinition using some of the chap 6 steps and guessing the rest.  It worked.  And I have created my first custom site.
 
Thanks Todd!!
 
Can't leave without asking one question though:
In the WEBTEMP_MySiteDefinition, the TEMPLATES Element.  What is the difference between the line in your WEBTEMP_ToddSiteDefinition:

<Templates xmlns="http://schemas.microsoft.com/sharepoint/">

and this one (which is how the WEBTEMP.XML appears by default):

<Templates xmlns:ows="Microsoft SharePoint">

I used the default and am wondering if these are synonyms for eachother or whether it matters whether we use one or the other.
 
Thanks in advance,
Paul
Posted: 6/28/2010 7:28 PM by



From:
Posted: Wednesday, May 09, 2007 10:17 PM
Subject: Todd, before I waste any more of my time, is this even possible?

If there is an answer to my earlier question ( what is: Failed to instantiate file "default.master" from module "DefaultMasterPage": Source path "default.master" not found?)  I'd like to know what it might be for troubleshooting purposes in future. 
 
However, I tossed the example in Chap 6 and just repeated the ToddSiteDefinition using some of the chap 6 steps and guessing the rest.  It worked.  And I have created my first custom site.
 
Thanks Todd!!
 
Can't leave without asking one question though:
In the WEBTEMP_MySiteDefinition, the TEMPLATES Element.  What is the difference between the line in your WEBTEMP_ToddSiteDefinition:

<Templates xmlns="http://schemas.microsoft.com/sharepoint/">

and this one (which is how the WEBTEMP.XML appears by default):

<Templates xmlns:ows="Microsoft SharePoint">

I used the default and am wondering if these are synonyms for eachother or whether it matters whether we use one or the other.
 
Thanks in advance,
Paul


 

From:
Posted: Tuesday, May 08, 2007 10:10 PM
Subject: Todd, before I waste any more of my time, is this even possible?

Hi Todd,
 
Thanks for redoing the example, I was able to get much further with this.  I am getting an error however when I try to create the site (Step 10 below, under the ToddSiteDefinition.zip VS.NET).
 
Can you shed any light on this one? here it is:

Failed to instantiate file "default.master" from module "DefaultMasterPage": Source path "default.master" not found

Thanks again,
Paul


From: Todd Bleeker
Posted: Friday, March 02, 2007 12:34 AM
Subject: Todd, before I waste any more of my time, is this even possible?

SharePoint Developer,
 
Just so you know, I didn't write SharePoint (WSS v3). That said, I personally think that WSS v3 is tremendous step forward for .NET developers. To me it represents Microsoft's version of Web 2.0 today. But, of course, you are certainly entitled to your own opinion.
 
I have created a Todd Site Definition (see screen shot below) for you, "where when a user (from either Central Admin or an end-user creating a sub-site) creates a site", the following eight lists are automatically provisioned (I didn't have a more specific name for the calendars and libraries so I used 1 and 2 as suffixes):
 1. Calendar 1
 2. Calendar 2
 3. Contacts
 4. Announcements
 5. Library 1
 6. Library 2
 7. Public Links
 8. Private Links
 
I assumed that you wanted a Contacts list called Contacts and an Announcements list called Announcements for the "2 lists". The first six lists are automatically added to the Quick Launch bar but the two Links lists are not (they are only shown as List View Web Parts on the home page, as requested).
 
The Web Parts on the default.aspx page have been changed to:
 1. Contacts list in the left Web Part Zone
 2. Announcements list in the left Web Part Zone
 3. Two link lists in the right Web Part Zone
      One for public links (pre-populated with two link entries)
      The other for private links
 
I even included some of my "best practices" for custom site definitions like including an alternate CSS and JS file, using a custom Master Page, and a custom RESX file.
 
All of this has been packaged into a WSS Solution Package (WSP) CAB solution. Download this file, unzip it, and rename it with a CAB extension; then double click on it to see the contents. Don't forget to rename it back with a WSP extension. You can then deploy this WSP into the WSS v3 Solution Store using the following steps:
 1. Download ToddSiteDefinitionWSP.zip.
 2. Unzip it on your SharePoint Web Front End server in a "c:\wsp" directory (you will probably have to create this directory, it isn't special but I used this location in the next step).
 3. Install the WSP CAB into the SharePoint Solution store using the following stsadm command:
      stsadm -o addsolution -filename "c:\wsp\Todd Site Definition.wsp"
Note: stsadm commands must run from the BIN directory of the 12 Hive.
 4. Deploy it to your entire SharePoint Farm using the following command:
      stsadm -o deploysolution -name "Todd Site Definition.wsp" -immediate
Note: This can also be done thru SharePoint 3.0 Central Administration Operations Manage Solutions link.
 5. Begin to create a new WSS v3 site; after providing a Title and URL Name, choose the Custom tab in the Template Selection section and select Todd Site Definition.
Todd Site Definition Create

 6. Click Create.
 7. The new site should look very similar to the site you requested:
Todd Site Definition
 
If you would like to tweak the code that created this WSP CAB, you can download my VS.NET 2005 project.
Todd Site Definition Solution
 
Use the following steps to unpack and deploy it into your developer environment (I'm assuming that you are developing on a standalone Windows Server 2003 box with WSS v3 and VS.NET installed). As you'll see, my approach to building custom site definitions has evolved since I wrote the chapter for the book.
 1. Download ToddSiteDefinition.zip, the VS.NET project.
 2. Unzip it into My Documents\Visual Studio 2005\Projects on your developer VPC. It will create a ToddSiteDefinition subdirectory containing the VS.NET solution.
 3. Open the ToddSiteDefinition.sln file to see the project's contents.
 4. View the post Build Events from the Project's Properties.
 5. Notice that I am both copying the files to the appropriate location in the 12 Hive AND using MakeCAB to create the WSP CAB in "c:\wsp" (this may be remarked out with REM, if that is the case just remove the REM and the WSP CAB will once again be created).
 6. Replace "SharePointAppPool" with the Application Pool that your SharePoint Web Application is using. If you are unsure of your Application Pool, be sure to run IISReset after step #7.
 7. Build the VS.NET project; this copies the custom site definition files to the 12 Hive, recycles "SharePointAppPool" Application Pool, and builds the WSP CAB in "c:\wsp".
 8. If you didn't change the application pool in step #6, run IISReset from any command prompt.
 9. Begin to create a new WSS v3 site; after providing a Title and URL Name, choose the Custom tab in the Template Selection section and select Todd Site Definition (see image above).
10. Click Create.
11. Again, the new site should look very similar to the site you requested.
12. To make alteractions: Change the files in the VS.NET project, recompile using Ctrl-Shift-B (or whatever keystrokes you like), and create a new site to see your changes. Changes to some elements like pages do not require the recreation of a site, but all changes to the ONET.XML do require the recreation of a site).
 
It took longer to write this response than it did to code and test the custom site definition. All in all I spent roughly 30 minutes on this response.
 
HTH,
 
<Todd />
 

From:
Posted: Thursday, March 01, 2007 3:53 PM
Subject: Todd, before I waste any more of my time, is this even possible?

First off, I'd like to say that SharePoint is the most unintuitive, craptastic technology I've ever had the displeasure of using.
 
That said, is this even possible:
I want to create a site definition, where when a user (from either Central Admin or an end-user creating a sub-site) creates a site:
1.  2 calendars, 2 lists, and 2 document libraries are created
  a.  All of the above are renamed
  b.  All of the above show up on the quicklaunch
 
2.  There are no default webparts on the default.aspx page:  Announcements, Image, Calendar, and Links.  I don't want any of those there.
  a.  In their place, I have a Contacts list in the left webpartzone, an Announcements list in the left webpartzone, and two link lists in the right webpartzone: 1 is for public links and 1 is for private.
     1.  The public links webpart is prepopulated with entries.
 
I've only found bits and pieces to the above problem in your book and from the internet, but, as usual, since we are talking sharepoint, the information is sparse.
 
Thanks in advance,
About to Quit Sharepoint Developer
Posted: 5/10/2007 1:46 PM by
Thanks Todd. This example helped me to understand the ONET.xml file much better. I would like to add other lists to my template, such as a Content Editor Web Part, but I do not know the FeatureID. Is there a list of FeatureIDs somewhere?
 
John
Posted: 3/6/2007 2:59 PM by
Todd,
Thank you for the write-up and the files.  I regret starting the thread the way I did.  As you could probably tell, I was at wit's end with SharePoint on that day, especially once I started trying to accomplish what you did in so little time.
 
In the future, I'll be sure to post when not angry =)
 
P.S. - I'm still not what would be called a SharePoint fan, but since it's my job, I have to "live" with it.  Hopefully I will be sold on it before I pull out the rest of my hair.

Posted: 3/6/2007 3:00 PM by
One more thing:
When I hit reply, IE7 is giving a pop-up for me to log in, yet the post still goes through.
 
Just thought you should know.