Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
5. January 2009 15:21 by Andreas

WSS 4.0 – New information about Windows SharePoint Services 4.0 / SharePoint 2009

Stefan Goßner, Escalation Engineer for SharePoint (WSS, SPS, MOSS) and MCMS, has announced in his blog post “First set of KB articles for a new Tool which will is planned to ship with WSS 3.0 SP2” some knowledge base articles about a new tool which will ship with Windows SharePoint Services 3.0 Service Pack 2 (WSS 3.0 SP2). The tool is called Pre-Upgrade Checker.

Pre-Upgrade Checker

This tools checks your SharePoint 2007 environment for potential upgrade issues if you want to upgrade to the next version of SharePoint but only if you have the upcoming Service Pack 2 installed. It is rule based and an stsadm.exe operation: You can find more information at the article List of all Windows SharePoint Services and SharePoint Server Pre-Upgrade Checker knowledge base articles.

The most important thing about these articles is the message: “The new XSLT-based list view is the default view that will be used in the next version release of Windows SharePoint Services. It will replace the existing list view in Windows SharePoint Services 3.0.” (KB956450)

New XSLT-based list view in WSS 4.0

Windows SharePoint Services 4.0 will ship with a new XSLT-based list view with the following improvements (KB956450):

  • SharePoint Designer customization support
  • conditional formatting and
  • improved developer experience with XSLT standard-based language support. ;)

CAML-based custom list views are still working but without the mentioned improvements. The following will not be upgraded to the next version of SharePoint (KB956450):

  • A list view that uses custom Collaborative Application Markup Language (CAML)
  • A list view that is not associated with a feature
  • A list view that is associated with a custom feature

By the way: Custom field types with CAML in its RendernPattern will also not be upgraded (KB956451).

Webparts are using controls (.ascx)

The Webparts will use controls so you can use a visual editor when creating your Webparts.

AD Account Creation mode

I have found at this discussion board a post about Questions regarding AD Account Creation mode?. I don’t really know what it is (I think account creation in the Active Directory over SharePoint) but it seems that it’s a feature from the previous version which is deprecated but still supported in WSS 3.0. This feature will not exist in WSS 4.0 as it is written in the document Creating Shared Hosting Solutions on Windows SharePoint Services 3.0. This document was linked by David Goebel.

Miscellaneous

The other Pre-Upgrade Checker rules are about large lists, the workflow actions file and new authorized types for workflow in web.config.

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
15. December 2008 19:26 by Andreas

MOSS 2007 / WCMS development - Overriding RenderFieldForDisplay from the classes RichHtmlField and RichImageField

Today it's time again for some MOSS 2007 / WCMS development... When implementing solutions for Microsoft Office SharePoint Server 2007 Publishing (WCMS) sometimes you have to inherit from a certain class and you have to override methods in order to extend the out of the box functionality. In my example I will extend the method RenderFieldForDisplay(HtmlTextWriter output) from the classes RichImageField and RichHtmlField. The method is used for rendering the field controls item value. In order to to this the object model offers

  • Microsoft.SharePoint.Publishing.WebControls
  • Microsoft.SharePoint.Publishing.Internal.WebControls

which can be found at:

  • Microsoft.SharePoint.Publishing.dll

Overriding RenderFieldForDisplay from the class RichImageField

When you want to override the RenderFieldForDisplay method of the class RichImageField you need to open the following namespaces:

using Microsoft.SharePoint.Publishing.WebControls

After opening the namespaces your class can inherit from RichImageField and override the methods of the class. In this example (which doesn't claims to be best practice) I capture the Html in the variable html of type string. Now you can modify the html by using string operators or regular expressions.

/// <summary>
/// Your summary...
/// </summary>
public class RichImageFieldOverride : RichImageField
{
    /// <summary>
    /// Your summary...
    /// </summary>
    /// <param name="output"></param>
    protected override void RenderFieldForDisplay(HtmlTextWriter output)
    {
        if (base.FieldName == null) { }
        if (base.FieldName == "") { }
 
        TextWriter tempWriter = new StringWriter();
        base.RenderFieldForDisplay(new HtmlTextWriter(tempWriter));
 
        string newHtml = tempWriter.ToString();
        //do what you like...
 
        output.Write(newHtml);
    }
}

First of all you can do some error handling stuff and after that you can get the Html be creating a new Textwriter object and getting the Html output from the base class. Now you can change the Html and at the end you can write the Html back to the output.

Registering the control

After compiling the code and putting the assembly in the Global Assembly Cache (GAC) you only need to register it at the top of your .aspx page:

<%@ Register TagPrefix="agl" Namespace="agl.Controls" Assembly="agl.Controls, 
Version=1.0.0.0, Culture=neutral, PublicKeyToken=****************"
%>

Of course you don't have to use the GAC if you have fulfill security requirements.

Using the control

After registering the control you can use it by putting the following line of code in your .aspx page:

<agl:RichImageFieldOverride ID="ID" FieldName="FieldName" 
runat="server"></agl:RichImageFieldOverride>

In edit mode there is no change since you have overridden the method RenderFieldForDisplay.

There is no change when you are in edit mode since you modified RenderFieldForDisplay. 

Overriding RenderFieldForDisplay from the class RichHtmlField

When you want to override the RenderFieldForDisplay method of the class RichHtmlField you need to open the following namespaces:

using Microsoft.SharePoint.Publishing.WebControls;
using Microsoft.SharePoint.Publishing.Internal.WebControls;

After opening the namespaces your class can inherit from RichHtmlField and override the methods of the class. In this example (which doesn't claims to be best practice) I capture the Html in the variable html of type string.

/// <summary>
/// Your summary...
/// </summary>
public class RichHtmlFieldOverride : RichHtmlField
{
    /// <summary>
    /// Your summary...
    /// </summary>
    /// <param name="output"></param>
    protected override void RenderFieldForDisplay(HtmlTextWriter output)
    {
        if (this.ItemFieldValue is string)
        {
            string html = this.ItemFieldValue.ToString();
            //do what you like...
 
            bool canCacheResults = true;
            output.Write(HtmlEditorInternal.ConvertStorageFormatToViewFormat(html, 
out canCacheResults));
            if (!canCacheResults)
            {
                base.CanCacheRenderedFieldValue = false;
            }
        }
    }
}

Again you can modify the html by using string operators or regular expressions like I have shown in the other example above.

Register control

After compiling the code and putting the assembly in the Global Assembly Cache (GAC) you only need to register it at the top of your .aspx page: 

<%@ Register TagPrefix="agl" Namespace="agl.Controls" Assembly="agl.Controls, 
Version=1.0.0.0, Culture=neutral, PublicKeyToken=****************"
%>

Of course you don't have to use the GAC if you have fulfill security requirements.

Use control

After registering the control you can use it by putting the following line of code in your .aspx page: 

<agl:RichHtmlFieldOverride ID="ID" FieldName="FieldName" 
runat="server"></agl:RichHtmlFieldOverride>

That's it for today with another MOSS 2007 / WCMS development article.

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
7. December 2008 12:13 by Andreas

White papers - New at andreasglaser.net

From today on there is a new section called "White papers" where I will post links to white papers I have written.

New section Whitepapers on andreasglaser.net

First of all I want to start with a paper called "Externe Speicherung von Binary Large Objects (BLOBs) mit SharePoint 2007 sowie SQL Server 2005 / 2008". It is written in German and deals with "SharePoint 2007, SQL Server 2005 and 2008, FileStream, External BLOB Storage and ISPExternalBinaryProvider". Here is a short introduction in German:

Dieses Whitepaper zeigt Möglichkeiten und Restriktionen bei der Speicherung von Daten mittels SharePoint 2007 und dem SQL Server 2005 (oder dem SQL Server 2008) extern auf dem Dateisystem zum jetzigen Zeitpunkt auf.

Schlagwörter wie „FileStream“, „EBS Provider“ und „externe Speicherung von grossen Datenmengen“ kursieren innerhalb der Anwendungsbereiche von SharePoint und SQL Server und werden viel diskutiert. Hinsichtlich der gegebenen Verwendungsmöglichkeiten dieser Features und den nicht zu unterschätzenden Einschränkungen gibt es allerdings aktuell kaum dokumentierte Erfahrungen im Einsatz dieser Features.

Diese Zusammenstellung der zentralen Fakten und Lösungsvarianten beleuchtet den richtigen Umgang mit grossen Datenmengen und deren Speicherung. Das Whitepaper vermittelt Entscheidungsträgern die Problematik des Umgangs mit grossen Datenmengen in SharePoint und stellt die gegebenen Lösungsmöglichkeiten gegenüber.

The white paper as well as an summary in English can be found here: White papers.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
26. November 2008 21:43 by Andreas

Installing Exchange Server 2007 with Service Pack 1 on Windows Server 2008 - Part 2

This is the second part of installing Exchange Server 2007 with Service Pack 1 on Windows Server 2008. You can see the scenario and the required features and server roles here: Installing Exchange Server 2007 with Service Pack 1 on Windows Server 2008 - Part 1.

Installation screen of Exchange Server 2007 with Service Pack 1

Pre-installation

Before you can start the installation you have to install the following components:

  • .NET Framework 2.0
  • Microsoft Management Console
  • Microsoft Windows PowerShell

You can either install the PowerShell by using the command line or you can use the Server Manager to add the required PowerShell feature. If you want to use the command line run the following command:

  • ServerManagerCmd -i PowerShell

Installing PowerShell by command prompt.  Successfull installation of PowerShell by command prompt. 

You can also use the Server Manager:

Installing PowerShell by using Server Manager 

Finally we can start the installation of Exchange Server 2007.

Installation

  • Click next at the introduction screen.
  • You can then turn on or off the error reporting.

Click next at the introduction screen. You can then turn on or off the error reporting.

  • Choose the typical installation of Exchange Server.
  • If you have Outlook 2003 clients in your environment choose yes, if not choose no.

Choose the typical installation of Exchange Server. If you have Outlook 2003 clients in your environment choose yes, if not choose no.

  • After that your system will be analyzed if all required features are installed.
  • If all required features are installed you shouldn't the the following screen with the red bullets.
  • If you get the error message "Setup cannot detect an SMTP or Send connector with an address space of '*'." you can refer to the following article: http://support.microsoft.com/kb/556055/en-us.

After that your system will be analyzed if all required features are installed.  If all required features are installed you shouldn't the the following screen with the red bullets.

  • Now you can start the installation process.

Now you can start the installation process.

  • After finishing the installation you have successfully installed Exchange Server 2007 in your environment.

After finishing the installation you have successfully installed Exchange Server 2007 in your environment.

Please not that this is not a best practice article on how to deploy Exchange Server in a production environment.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
16. November 2008 20:58 by Andreas

Running SharePoint 2007 in a Hyper-V virtual environment

As I have written several times I use a virtual environment to develop SharePoint 2007 solutions. Some of the articles are:

Right know I switch between Virtual Server 2005 and Hyper-V. If you are thinking about running SharePoint 2007 in a Hyper-V virtual environment the following articles by Microsoft  are a must read:

Hyper-V basics

Hyper-V Windows Server 2008 role picture

I have written about the basics at my companies SharePoint blog: Windows Server 2008 Hyper-V: Windows Server 2008 Hyper-V is the Hypervisor based Virtualization function of Windows Server 2008. As you know Virtualization has a lot of advantages like running more than one server on a physical machine or higher security when separating server functionality. Hyper-V uses the native Virtualization method where the Virtual Machine Manager runs directly on the hardware. This is a huge performance gain compared to hosted Virtualization where the Virtual Machine Manager gets the resources from the operating system.

If Hyper-V is activated the partition with the host operating system (parent partition) is treated like the partitions with the virtual machines (child partitions). Both of them consume resources from the Hypervisor. The Virtualization stack, the process and the wmi provider for managing the virtual machines are located in the parent partition.

Supported Hypervisor technology

SharePoint Products and Technologies supports

Hyper-V prerequisites

Hyper-V is a role that can be turned on if your Windows Server 2008 installation meets the following requirements:

  • The OS runs on a machine with a x64-based processor.
  • Your machine supports hardware-assisted Virtualization.
  • You have hardware data execution protection turned on.

Hyper-V recommendations

The following recommendations are written in the articles Using SharePoint Products and Technologies in a Hyper-V virtual environment and Performance and capacity requirements for Hyper-V. For more details please read the articles. A short summary:

In general

  • Use Windows Server 2008 as the guest operating system.
  • Install integration components (ICS).
  • Install the Hyper-V update for Windows Server 2008 (KB950050) on the host and guests.
  • "Do not use the Hyper-V snapshot feature on virtual servers that are connected to a SharePoint Products and Technologies server farm. This is because the timer services and the search applications might become unsynchronized during the snapshot process and once the snapshot is finished, errors or inconsistencies can arise. Detach any server from the farm before taking a snapshot of that server."

Networking

  • Use IPv4 as the network protocol for Hyper-V guests and disable IPv6. (Update 18. November: I don't recommend this when running an Exchange Server 2007 on your image)
  • Use Private or internal networks. "Private networks and internal networks do not use the physical network card or cable, so communications are faster and network congestion is minimized. You can take advantage of this network performance gain by creating an external network for the Web front-end servers and by creating a private or internal network for the application and SQL Server database servers."

CPU and hard disk

  • Use a fixed-size virtual disk for hosting the Index role or SQL Server. You can use a dynamically-sized disk for hosting the Query role or Web Server role.
  • "Do not use more virtual CPUs than there are physical CPUs on the Hyper-V host computer. Although Hyper-V will allow you to allocate more virtual CPUs than the number of physical CPUs, this causes performance issues because the hypervisor software has to swap out CPU contexts."

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
9. November 2008 17:48 by Andreas

MOSS 2007 / WCMS development - PortalSiteMapProvider, SiteMapNodeCollection, SiteMapNode - SPNavigationNodeCollection, SPNavigationNode and IsVisible

When implementing solutions for Microsoft Office SharePoint Server 2007 Publishing (WCMS) sometimes you have to implement a custom navigation. Therefore the object model offers

  • Microsoft.SharePoint.Navigation
  • Microsoft.SharePoint.Publishing.Navigation

which can be found at:

  • Microsoft.SharePoint.dll
  • Microsoft.SharePoint.Publishing.dll

SharePoint 2007 Publishing Navigation

Basics

If you create a Publishing site you can modify the navigation as shown in the following pictures:

Accessing the publishing site navigation page. Modifiying the publishing site navigation.

While creating a publishing site the "Portal Navigation Properties" feature is called. You can find the call of the feature in one of the different onet.xml files used for Publishing. Please note that there is more than one Publishing site template and site definition.

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\PUBLISHING\XML\onet.xml

<Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA">
<!-- Per-Web Portal Navigation Properties-->
  <Properties xmlns="http://schemas.microsoft.com/sharepoint/">     
<
Property Key="InheritGlobalNavigation" Value="true"/>     <Property Key="ShowSiblings" Value="true"/>     <Property Key="IncludeSubSites" Value="true"/> </Properties> </Feature>

As you can see there a properties like "ShowSiblings" you can set during the call. The "Portal Navigation Properties" feature is stored at the following location:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\NavigationProperties\feature.xml

<Feature  Id="541F5F57-C847-4e16-B59A-B31E90E6F9EA"
          Title="Portal Navigation Properties"
          Description="Set per-site navigation properties."
          Version="12.0.0.0"
	  Scope="Web"
	  Hidden="TRUE"
	  ReceiverAssembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, 
                             Culture=neutral, PublicKeyToken=71e9bce111e9429c"
          ReceiverClass="Microsoft.SharePoint.Publishing.NavigationFeatureHandler"
          xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests>
        <ElementManifest Location="NavigationSiteSettings.xml"/>
    </ElementManifests>
</Feature>

Changing the properties in onet.xml affects the settings. Please note: It is not recommended to change out of the box files. If you want to test it you do an iisreset in order to make sure the changes apply when you create a new publishing site.

Mapping of the onet.xml feature call and properties to the SharePoint publishing site navigation menu. 

Microsoft.SharePoint.Navigation

Programmatically accessing current navigation in SharePoint Publishing

There are different ways to access the current navigation. The namespace

using Microsoft.SharePoint.Navigation;

offers objects like SPNavigationNodeCollection or SPNavigationNode. I tried it this way but it didn't work for me and my scenario.

if (PublishingWeb.IsPublishingWeb(ElevatedSite))
{     
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(ElevatedSite);
    SPNavigationNodeCollection nodeColl = pubWeb.CurrentNavigationNodes;    
    foreach (SPNavigationNode node in nodeColl)     
{        
        //The following statement allways returns true        
        if (node.IsVisible)        
        { }
 
      //The object will be null        
        object test = node.Properties["vti_nonnavpage"];    
    }
}

First of all I had to modify the navigation at the publishing site before it showed up in the nodeColl. Second it is not possible the determine if a site or page is hidden because the property "vti_nonnavpage" is not in the property bag of the SPNavigationNode "node" and therefore the getter of property "IsVisible" always returns true. The getter is implemented to return true if it can't find the property. Because of that I tried the PortalSiteMapProvider.

Microsoft.SharePoint.Publishing.Navigation

Programmatically accessing current navigation in SharePoint Publishing with the ProtalSiteMapProvider

You can find the PortalSiteMapProvider in the namespace

using Microsoft.SharePoint.Publishing.Navigation;

In order to get the current navigation you can use the following code:

PortalSiteMapProvider map = new PortalSiteMapProvider();
SiteMapNodeCollection nodeColl = map.CurrentNode.ChildNodes;
	
foreach (SiteMapNode childNode in nodeColl)
{     
    //childNode.Title;    
    //childNode.Key;     
    //childNode.Url;
}

This code returns a sorted list without the navigation nodes which are hided. You can also access a certain node by using the method FindSiteMapNode with an Url as the parameter.

PortalSiteMapProvider map = new PortalSiteMapProvider();
SiteMapNode node = map.FindSiteMapNode("/PressReleases");
SiteMapNodeCollection nodeColl = node.ChildNodes;
	
foreach (SiteMapNode childNode in nodeColl)
{    
    //Your code...
} 

For me and my scenario the PortalSiteMapProvider was the way to go. And: You can avoid the problems when using the IsVisible property.

That's it for today... ;)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
2. November 2008 13:07 by Andreas

MOSS 2007 / WCMS development - Microsoft.SharePoint.Publishing and Microsoft.SharePoint.WebControls

Since today I want to write about the object model of SharePoint 2007  because there are some goodies that helped me a lot when implementing solutions for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0. I want to start with the namespaces

  • Microsoft.SharePoint
  • Microsoft.SharePoint.WebControls
  • Microsoft.SharePoint.Publishing
  • Microsoft.SharePoint.Publishing.WebControls

which can be found at:

  • Microsoft.SharePoint.dll
  • Microsoft.SharePoint.Publishing.dll

Microsoft.SharePoint and Microsoft.SharePoint.WebControls

Programmatically determine the display mode or edit mode of a website

Imagine the following scenario: You have a WCMS website and want to programmatically determine if the whole website is in display mode or edit mode. The namespace

using Microsoft.SharePoint.WebControls;

offers the SPControlMode enumeration with the members:

  • Display
  • Edit
  • Invalid
  • New

You can check the current mode by using the SPContext.Current object:

if (SPContext.Current.FormContext.FormMode == SPControlMode.Edit)
{
}

If you want implement a custom WebControl you can use Microsoft.SharePoint.WebControls.SPControlMode.Display to determine if your custom WebControl is in display or edit mode.

Programmatically adding FieldControls, OnLoad, CreateChildControls

Imagine the following scenario: You have a WCMS website and want to programmatically add FieldControls depending on a certain situation. The namespace you can utilize is

using Microsoft.SharePoint.WebControls;

You have different options adding FieldControls at runtime. One option is a UserControl you can call in the page layout. You can override the method CreateChildControls() of the UserControl.

protected override void CreateChildControls()
{
    base.CreateChildControls();
 
    //If current page is in edit mode 
    if (SPContext.Current.FormContext.FormMode == SPControlMode.Edit)
    {
        TextField txtField = new TextField();
        txtField.ID = "FieldControlID";
        txtField.FieldName = "FieldControlFieldName";
 
        DateTimeField dateField = new DateTimeField();
        dateField.ID = "FieldControlID";
        dateField.FieldName = "FieldControlFieldName";
 
        DropDownChoiceField ddField = new DropDownChoiceField();
        ddField.ID = "FieldControlID";
        ddField.FieldName = "FieldControlFieldName";
 
        this.Controls.Add(txtField);
        this.Controls.Add(dateField);
        this.Controls.Add(ddField);
    }
}

This example adds FieldControls of type Text, DateTime and Choice to the page. The FieldControlFieldName has to be the name of a column attached to the pages library (ideally by a content type ;) ).

The FieldControlFieldName has to be the name of a column attached to the pages library.

If you want to get access to the FieldControls value you can use the property ItemFieldValue:

TextField.ItemFieldValue
DateTimeField.ItemFieldValue
DropDownChoiceField.ItemFieldValue

In order to access a FieldControl of type RichHtml you should use

SPFieldMultiLineText richHtml = new SPFieldMultiLineText(SPContext.Current.Fields, 
                                                         "FieldControlFieldName");

where FieldControlFieldName is again the name of a column attached to the pages library. You can access the FieldControls value by using

object value = rightColumn.FieldRenderingControl.ItemFieldValue;

If you use this way you shouldn't get the following error:

Unable to cast object of type 'Microsoft.SharePoint.Publishing.Fields.HtmlField' to type 'Microsoft.SharePoint.SPFieldText'.

Microsoft.SharePoint.Publishing and Microsoft.SharePoint.Publishing.WebControls

Microsoft.SharePoint.Publishing.PublishingWeb

The namespace

using Microsoft.SharePoint.Publishing; 

offers a class called PublishingWeb. You can use it to check if the current SPWeb is of type PublishingWeb:

SPWeb currentWeb = SPContext.Current.Web;

if (PublishingWeb.IsPublishingWeb(currentWeb))

{
    pubWeb = PublishingWeb.GetPublishingWeb(currentWeb);
 
    string title = pubWeb.DefaultPage.Title;
    string title = pubWeb.DefaultPage.ServerRelativeUrl;
}

If a SPWeb object is of kind PublishingWeb you can create an object of type PublishingWeb where you can easily access the default page object.

Furthermore you can use the out of the box dialogs (i.e. for browsing the site in order to get the URL of a list) when using

using Microsoft.SharePoint.Publishing.Fields;
using Microsoft.SharePoint.Publishing.WebControls;

image 

RichLinkSelector mLinkSelector = new RichLinkSelector();
HtmlTagValue htmlTagValue = mLinkSelector.Value;

If you want to get an object where you can access properties like the text or the navigation URL you can use the LinkFieldValue:

LinkFieldValue link = new LinkFieldValue(mLinkSelector.Value.ToString());

There you can get and set properties like 

link.Text = "";
link.NavigateUrl = "";
link.Target = "";
link.ToolTip = "";

You can also set a predefined URL for the RichLinkSelector:

mLinkSelector.Value = link;

That's it. The SharePoint object model has a lot of cool stuff but sometimes you have to know about it. I hope there are some goodies for you... Please remember that this is not a best practice article since it should only give an overview of what is possible with the SharePoint object model.