Blog Home  Home Feed your aggregator (RSS 2.0)  
My DasBlog! - Tuesday, December 06, 2005
newtelligence powered
 
# Monday, December 05, 2005

I always forget the exact order in which events fire. So i found the following when i googled and wanna share it with you all :)

Page.Init + Control.Init for every control on the Web Form
The first stage in the page life cycle is initialization. After the page's control tree is populated with all the statically declared controls in the .aspx source the Init event is fired. First, the Init event for the Page object occurs, then Init event occurs for each control on the Page. Viewstate information is not available at this stage.

Page.LoadViewState
After initialization, ASP.NET loads the view state for the page. ViewState contains the state of the controls the last time the page was processed on the server.

Page.ProcessPostData
Post Data gets read from the request and control values are applied to control initalized in stage 1.

Page.Load + Control.Load for each control on the Page
If this is the first time the page is being processed (Page.IsPostback property), initial data binding is performed here.

"Change" events are fired for controls
(TextChanged, SelectedIndexChanged, and similar) The current value (from Post Data) is compared to the original value located in the ViewState. If there is a difference "Changed" events are raised.

Server-side events are fired for any validation controls
Button.Click + Button.Command
The Click and Command events are fired for the button that caused the postback

Page.PreRender + Control.PreRender

Page.SaveViewState
New values for all the controls are saved to the view state for another round-trip to the server.

Page.Render

Monday, December 05, 2005 1:09:45 PM (GMT Standard Time, UTC+00:00)  #    Comments [5]   ASP.NET | C#  | 
# Monday, November 28, 2005

Today i'm giving a presentation for a group of students about a project using SharePoint. In my case its a project built in Windows SharePoint Services (WSS).

Last week i was at the customers location and did a backup of the WSS site. Today i tried to set it up in my Virtual PC environment, and with success! :)

There are still some issues which are not handled by the backup / restore functionality of stsadm command.

Just for your information some of these issues:

  • It is only possible to restore the WSS site when the same or higher service pack is installed
  • If you're using Custom WebParts. You have to copy them into your bin folder or install them into the GAC.
  • Also do not forget to place the <SafeControl> entry in the web.config file
  • If you're using SessionState do not forget to turn it on in the web.config file
  • I always advise to create per site your own layouts and images folder. Change the paths of the virtual directories in IIS

I used the following command line to restore the database:

stsadm -o -restore -url http://somsite -filename d:\pub\somesite.bkp -overwrite

Monday, November 28, 2005 8:33:56 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   SharePoint  | 
# Wednesday, October 26, 2005

Its always a fact that Microsoft does not support modifications to database schemas or database structures of SharePoint. These changes can be overwritten by service packs, upgrades or new versions of the product.

But.... still.... i came accross an article by Andy May which contained a link to the MSDN of microsoft where Microsoft describes each table of the SharePoint database. It still contains a Microsoft standard warning at the top. :)

So, whats the reason for this? Why listing the database tables?

The link to MSDN can be found at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/tsdbTables_SV01051532.asp

The article of Andy May can be found at:

http://www.sharepointblogs.com/andymay/archive/2005/10/25/4025.aspx
Wednesday, October 26, 2005 7:45:54 AM (GMT Daylight Time, UTC+01:00)  #    Comments [3]   SharePoint  | 

I always like these kind of postings. Proofing that some things are possible :) In his example he adds a WebPart Page to a Document Library by altering some code in the well-known ONET.XML. Do not be afraid of editing this file. Its quite easy to understand whats going on.

Check your documentation "Microsoft SharePoint Products and Technologies 2003 Software Development Kit" (file spptsdk.chm) and look for ONET.XML. You will find an article describing each bit of this file.

The article describing pre-populating a document library can be found at:

http://blogs.msdn.com/cjwalker/archive/2005/10/26/484879.aspx

Thanks to Christopher Walker!

Wednesday, October 26, 2005 7:38:00 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   SharePoint  | 

Todd wrote a nice article about showing styles when moving your cursor around. A lot of people asked him how to alter elements of WSS WebPart Pages. He gives a good walk-through and some code. Thanks Todd :)

http://mindsharpblogs.com/todd/archive/2005/10/25/798.aspx

Wednesday, October 26, 2005 7:26:50 AM (GMT Daylight Time, UTC+01:00)  #    Comments [1]   C# | SharePoint  | 
# Tuesday, October 25, 2005

I found a nice topic in the SharePoint documentation which explains the properties that can be set on the command line using the stsadmin.exe tool with the getproperty and setproperty operations. This is as follow:

stsadm.exe -o getproperty -pn <property name> [-url <url>]
stsadm.exe -o setproperty -pn <property name> -pv <property value> [-url <url>]

As stated in the "Microsoft Office SharePoint Portal Server 2003 Administrator's Guide" (file SharepointPSAdmin.chm):

"Some properties are available for the entire server, and are called server properties. Some are only available for an individual virtual server. When you get or set a server property, you can omit the url parameter. You must include the url parameter to get or set virtual server properties. For more information about setting properties, see "Introducing the Administration Tools for Windows SharePoint Services" in the Windows SharePoint Services Administrator's Guide."

The properties are divided in several categories:

Server Properties for Windows SharePoint Services

  • Antivirus properties
  • Data retrieval services properties
  • HTML Viewer properties
  • Site confirmation and automatic deletion properties
  • Usage analysis properties


Virtual Server Properties for Windows SharePoint Services

  • Alert properties
  • Content database properties
  • Data retrieval services properties
  • General properties
  • Site confirmation and automatic deletion properties

Lookup "Command-Line Properties" in the mentioned file for the complete list and explaination of each property divided over the categories.

But it would be nice if you can access these properties programmatically. This is possible with the following code:

Microsoft.SharePoint.Administration.SPGlobalAdmin globAdmin = new Microsoft.SharePoint.Administration.SPGlobalAdmin();
Microsoft.SharePoint.Administration.SPGlobalConfig globConfig = globAdmin.Config;

SPPropertyBag propBag = globConfig.Properties;
System.Collections.ICollection keys = propBag.Keys;

foreach (object key in keys)
{
   output.Write(SPEncode.HtmlEncode(key.ToString()) + " :: " + 
   SPEncode.HtmlEncode(propBag[key.ToString()]) + "<BR>");
}

Tuesday, October 25, 2005 2:20:33 PM (GMT Daylight Time, UTC+01:00)  #    Comments [4]   SharePoint  | 
# Thursday, October 20, 2005

I got a lot of questions of colleages regarding custom templates and site definitions.

As stated in the help: "A custom template is a customization applied to a site definition. When a user customizes a site or list in the user interface, the custom template consists of the difference between the original state of the site or list as determined by its definition and the state of the site when the custom template is generated. Custom templates remain tied to a particular site definition (for example, the one for a SharePoint site or a Meeting Workspace site), so that if the site definition is not present or is changed, the custom template will not work."

In many cases building Portals with SharePoint Portal Server you want to change the defined Site definitions. These Site definitions are the templates you can choose from when you create a new site.

The problem with changing a Site definition is that when somebody else in another Portal creates a site with the same template, he is also getting your changes. So the following sequence of steps can be taken to create your own Site definition.

The first thing you have todo is copy an existing Site definition and rename it. Existing site definitions are found in the folder <localdrive>:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\Template\<localeid>. For example copy the STS folder and rename it to MYSTS.

In this folder you will find an XML folder containing the file ONET.XML. This is the schema file containing Collaborative Application Markup Language (CAML). If you want to make changes to the listings, WebParts and other stuff showing up when creating a site, this is file to make the changes in.

The next step is telling SharePoint that there is a new template defined. Under the folder <localdrive>:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\<localid>\XML you will find a schema file called WEBTEMP.XML. Copy this file and call it WEBTEMPMY.XML. It is very important that the name of the file starts with WEBTEMP.

Your WEBTEMPMY.XML will look like this:

<?xml version="1.0" encoding="utf-8" ?>
<!-- _lcid="1033" _version="11.0" _dal="1" -->
<!-- _LocalBinding -->
<Templates xmlns:ows="Microsoft SharePoint">
   <Template Name="MYSTS" ID="10200">
      <Configuration ID="0" Hidden="False" Title="<some title>" Type="0" ImageUrl="<someimage>" Description="<somedescription>"> 
      </Configuration>
 </Template>
</Templates>

The following things are very important:

  • Make sure that the Name property of the Template element is the same as the name of your folder.
  • The ID property of the Template element should be in the range of 10000 or higher. Make sure its not used anywhere else.
  • The ID property of the Configuration element points to a configuration with the same id in the ONET.XML.
  • Property Hidden determines if the template should appear in the list when creating sites. It could be that you create your own sites based on the Site definition in a custom WebPart and users are not able to use your Site definition.

The final step is resetting the IIS by calling iisreset. It also works when recycling the application pool used by your Portal.

Further information regarding this subject can be found in the article "Creating a Site Definition from an Existing Site Definition" in Microsoft SharePoint Products and Technologies 2003 Software Development Kit.

And finally a good article which goes further into this by Robert Bogue:

http://www.devx.com/dotnet/Article/27673/0

 

Thursday, October 20, 2005 10:01:30 AM (GMT Daylight Time, UTC+01:00)  #    Comments [4]   SharePoint  | 

Did you ever wonder where those sites went if you create one under the Sites directory within SharePoint Portal Server? I did! If you try to list a sites by using the SPSite.AllWebs they will not show up. Why? So far as I can see they are created as "floating" sites. But there is a way to list them. The Sites directory is a Area and can be found easily.

First create a TopologyManager and retrieve the PortalSite object by using an Uri object.

TopologyManager topologyManager = new TopologyManager();
Uri uri = new Uri("
http://localhost/");

PortalSiteCollection sites = topologyManager.PortalSites;

PortalSite portalSite = sites[uri];

Then get the PortalContext and use this to get the Guid of the SystemArea. The SystemArea is an enumeration providing you some starting points of Areas.

PortalContext portalContext = PortalApplication.GetContext(portalSite);

Guid homeGuid = AreaManager.GetSystemAreaGuid(portalContext, SystemArea.Home);

Based on the Guid its very easy to retrieve the actual Area object. And based on that Area object we retrieve the Sites Area object from its children.

Area homeArea = AreaManager.GetArea(portalContext, homeGuid); 
Area sitesArea = homeArea.Areas["Sites"];

Loop through the AreaListings in this Area object and check if its type is ListingType.Site. The URL property contains the url to the created sites.

foreach(AreaListing listing in sitesArea.Listings)
{
   if (listing.Type == ListingType.Site)
   {
      output.WriteLine(String.Format("{0} ({1})<br>", listing.Title, listing.URL));
   }
}

Thursday, October 20, 2005 7:35:29 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   SharePoint  | 
# Wednesday, October 19, 2005

I found an impressive list of SharePoint links to divided in several categories. The list is made by Eric and can be downloaded as a zipped .htm file for importing into Internet Explorer. The list can be found at the following url:

http://blogs.officezealot.com/legault/archive/2004/08/08/2238.aspx
Wednesday, October 19, 2005 9:29:09 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   SharePoint  | 
# Monday, October 17, 2005

I'm doing some research about areas in SPS 2003. During my research i found a control called BreadCrumbTrail in the namespace Microsoft.SharePoint.Portal.WebControls which indicates were the current area is in the portal structure. Some googling brought me to the blog of Manuel Montes. He gives us an example of how to use the control. Thanks Manuel! :)  

See below:

  • Open any of the default.aspx pages for an area template in your favourite editor. For example, the SPSTOPIC\default.aspx page.
  • Locate the following code that renders the page title:
    <tr> <td ID="onetidPageTitle" class="ms-pagetitle"> <SPSWC:CategoryProperty runat="server" Property="Name" /> </td> </tr>
  • Comment this entry
  • Replace the code with the following:
    <tr><td><spswc:breadcrumbtrail id="BreadCrumbTrail2" runat="server" titlelocid="MultiPage_BreadcrumbWebPartTitle" verticalmode="false" frametype="None"></td></tr>

Note that you will need to give the control a unique ID ("BreadCrumbTrail2") ast here is another control already on the page.

  • Save the Page and take a look… You should see something like this in place of the Page Title.
    Back to: Home > Topics > Applications

Changing the appearances can be done changing the following styles:

.bc-cell
.bc-htable
.bc-trail
.bc-leadin
.ms-vb bc-cell

http://pasteldelimon.blogspot.com/2005/06/breadcrumb-links-for-sps-areas.html

Monday, October 17, 2005 9:48:32 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   SharePoint  | 
Copyright © 2012 Alexander Meijers. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: