[Home] [Recent] [Site Map] [SharePoint] [XBOX]
I have created a number of templates for various types of sites for our internal MOSS. One of these are a customer site that - among other things - has a subsite for all our projects related to this customer.
When I save this site as a template I include all the content as I've created a number of custom web part pages in a document library that we use but there is no way for me to include the project subsite.
Would it be possible to use a solution file for this? According to this MSDN article it doesn't sound like a solution file is the answer.
Is there an easy way to accomplish this or am I forced to create the project subsite manually for each new customer?
Information Provided by Microsoft SharePoint Product & Technologies Team:
The SharePoint End User Training Kit is Microsoft ShairePoint Product & Technologies offering for End User Material and it's available at no cost!The initial release of the kit includes training content for SharePoint's collaboration capabilities. To be added over the next couple of months are additional modules covering portals and personalization, enterprise content management, search, business processes, and business intelligence. All of the content will have been written by the Office Online User Assistance team.
Grab it Here http://www.codeplex.com/slk The kit will be provided with two deployment options. The first, which is available now, is via the SharePoint Learning Kit ("SLK"), which is SCORM 2004 conformant e-learning delivery and tracking application built as a WSS 3.0 solution. With the SLK, IT personnel can control the look and feel of the training kit, matching it to corporate branding standards, and administrators can add or remove content and customize it as necessary. The SLK also provides a reporting function that shows which topics have been completed and by whom.The SharePoint End User Training Kit will also have a standalone deployment option, which can be installed on a PC and used by an individual. This version of the kit will be available within the next few weeks.
I had a requirement that required me to create a custom base for web parts to provide a common library for web part development within MOSS. I started to research on how this could be done and found very little information that explained the whole process of trying to achieve this and literally any form of reference to this topic in the 3.0 WSS SDK August 2007 did not exist. So I needed to do something to assist the development community.
So lets cut the chase and start showing you how this is done.
Firstly we need to create a new class project within Visual Studio and lets call this WebPartBase. In this example we will retrieve the webpart id and title of the webpart and place this in a protected string called WebPartID and WebPartTitle, I have also included some of the site properties into the base class. Our Base class will inherit from the System.Web.UI.WebControls.WebParts.WebPart base class, which is the base class Microsoft provide you to inherit for developing web parts. Our custom web part will inherit our custom base class, which for the purpose of the blog will only be two properties from the webpart and three properties from the Site object and place them into a strings. As soon as we inherit our base class we automatically inherit these strings into our web part. When we put this into perspective, you have the whole .Net framework their available to you as a developer that could be used as a library for comon tasks that you may require for all your web part development. e.g. Application Logging, Standardise on variable name's across your Line of Business applications for all web parts, custom behaviour across the board for all web parts, etc. I think you get the picture. ![]()
Lets Get Started.
1. Create New Class Project within Visual Studio 2005 and call this WebPartBase.
Add the following bit of code into your WebPartBase class so it should like something like this.
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
namespace bobby.habib.base
{
public class PortletBase : System.Web.UI.WebControls.WebParts.WebPart
{
/// <summary>
/// Public default constructor.
/// </summary>
public PortletBase()
{
}
#region Web Part Settings
protected string WebPartID
{
get
{
return base.ID;
}
}
protected string WebPartTitle
{
get
{
return base.DisplayTitle;
}
}
#endregion
#region Site Settings
protected string SiteID
{
get
{
try
{
SPWeb oSite = SPControl.GetContextWeb(Context);
try
{
return oSite.ID.ToString();
}
catch (Exception exm)
{
throw new Exception(exm.Message);
}
finally
{
oSite.Dispose();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
protected string SiteTitle
{
get
{
try
{
SPWeb oSite = SPControl.GetContextWeb(Context);
try
{
return oSite.Title;
}
catch (Exception exm)
{
throw new Exception(exm.Message);
}
finally
{
oSite.Dispose();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
protected string SiteName
{
get
{
try
{
SPWeb oSite = SPControl.GetContextWeb(Context);
try
{
return oSite.Name;
}
catch (Exception exm)
{
throw new Exception(exm.Message);
}
finally
{
oSite.Dispose();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
#endregion
}
}
2. Complie this code. You will notice that we automatically will inherit a number of values that could be used, as part of your framework library for web part development.
3. The next step is to now create a web part that will inherit from the custom base class we have just built, rather then using the System.Web.UI.WebControls.WebParts.WebPart base class. So lets create a new web part using visual studio, when creating your web part you must add a reference in your web part project to the custom base class we have just created.
Your web part project should look like this;
using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using bobby.habib.base;
namespace Bobby.Habib.WebParts.BaseTest
{
public class BobbyHTest : PortletBase
{
public BobbyHTest()
{
this.ExportMode = WebPartExportMode.All;
}
#region GUI Controls
// GUI Panels
private Panel _MainPanel;
#endregion
protected override void Render(HtmlTextWriter writer)
{
_MainPanel.RenderControl(writer);
}
protected override void CreateChildControls()
{
#region Control Declaration
_MainPanel = new Panel();
#endregion
Table outerTable = new Table();
outerTable.CellPadding = 0;
outerTable.CellSpacing = 0;
outerTable.Width = 400;
// Row 1
TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.Width = 800;
string strTxT = string.Empty;
strTxT = strTxT + "<b>Web Part Information</b><br>";
strTxT = strTxT + "base.ID - " + WebPartID + "<br>";
strTxT = strTxT + "base.Title - " + WebPartTitle + "<br>";
strTxT = strTxT + "<b>Site Information</b><br>";
strTxT = strTxT + "Site ID - " + SiteID + "<br>";
strTxT = strTxT + "Site Name - " + SiteName + "<br>";
strTxT = strTxT + "Site Title - " + SiteTitle + "<br>";
strTxT = strTxT + "Display Title - " + WebPartTitle + "<br>";
cell.Text = strTxT;
row.Cells.Add(cell);
outerTable.Rows.Add(row);
_MainPanel.Controls.Add(outerTable);
base.CreateChildControls();
}
}
}
4. Compile the above code.
5. If you have the Visual Studio 2005 and have installed Visual Studio 2005 extensions for WSS3, you could go into the web part project properties and do the following;
6. You may need to copy your custom base class to the GAC, if you have not configured your solution files to copy the base class into the GAC. If during the time of deployment you find that the project starts error during the deployment. The likely cause is your web part cannot see the custom base class in the GAC and throws a reflection error. Ensure that the base class is in the GAC and is registred as a safe control in the web.config file of the site you are trying to deploy too.
7. Add the web part into a site page in MOSS and you will see the property values being displayed in the web part, that have been inherited from our custom base class.
I hope this helps a developer.
I've tested a form before and after installing the hotfix:
| IE6.0* | IE7.0* | |||
| Without hotfix | With hotfix | Without hotfix | With hotfix | |
|
Rendering |
65 sec | 15 sec | 14 sec | 13 sec |
| CPU Load | 99% | 99% | 50% | 50% |
| RAM | 60mb | 30mb | 68mb | 40mb |
|
* IE6 en IE7 installed on different hardware, do not compare the results between browsers | ||||
The following articles describe which is best for your situation:
http://technet2.microsoft.com/Office/en-us/library/3c4e8fb1-c3ce-4d27-8c65-6c4ab140f7051033.mspx?mfr=true
http://technet2.microsoft.com/Office/en-us/library/3728d1fa-c1db-4445-8d00-e26f9015dd951033.mspx?mfr=true
Be sure to check Tim Pashmans blogpost on IFS performance:
http://blogs.msdn.com/timpash/archive/2007/08/02/tips-and-tricks-for-tuning-forms-services-performance.aspx
Site List:
>>Xbox Live_s Major Nelson
>>Xbox 360 & SharePoint 2007 Weblog
>>Carsten Keutmann_s Blog
>>Mohamed Zaki_s Blog [Sharepoint MVP]
>>The Mit_s Blog
>>Mart Muller_s Sharepoint Weblog
>>Microsoft SharePoint Products and Technologies Team Blog
>>SharePoint Solutions Blog
>>4GuysFromRolla.com Headlines
>>ASP.NET Blogs
>>SharePoint Blogs
>>SharePoint Blogs
>>Joel on Software
>>ADO Guy_s Rants and Raves
>>Microsoft Live Labs
>>GadgetNews
>>Windows Vista Team Blog
>>VoIP & Gadgets Blog
>>schrankmonster blog
>>Via Virtual Earth Blog
>>Feed
>>MSDN Blogs
>>Mashable!
Links:
Jack's Readings
Month Archives:
Oct 2007
Sep 2007
Top Tags:
social software social networking .NET mashable Sharepoint ASP.NET Web 2.0 Web2.0 Startups Community News Search Marketplace General Software Development AJAX Windows Vista Visual Studio Microsoft myspace Silverlight People Powered! YouTube Vista MOSS Featured News C# Events MOSS 2007 Google WPF Office 2007 Web Community Security General Personal Xbox 360 facebook Tools development SharePoint 2007 Fun Atlas Architecture ASP.NET AJAX myspace codes TheLongTail IIS SQL Server Developers Revenue Sharing Video Pictures WCF Mobile 2.0 Announcements Orcas MIX07 Arcade Team System JavaScript News
@2007 All rights Reserved |