Archive for the ‘ASP.Net Frameworks’ Category

MOSS8 / Create Site Columns in SharePoint Server

Thursday, June 12th, 2008

SharePoint team and Project server team at offshoresoftwaredevelopmentindia.com has great experience of creating web application based on MOSS 2007 and Project server 2007. That includes customization and development of webpart, site definitions, theme development, extension development, module creation. The team has developed CRM application, Job portal, Project management, to CMS applications based on MOSS 2007 and project server 2007.

Team would like to share same experience. This can help who wanted to begin with the sharePoint development and Project Server development.

There are list of articles start with SP and from number 1 to …. Always start with the article SP1 and read next article to start working on MOSS easily and quickly.

Creating Site Columns:

In this 3 part series I will explain the steps you need to follow in order to create site columns, content types and page layouts for use with a MOSS publishing site.

There is already quite some information to be found on the internet on how to create site columns and custom lists using a feature, however most part apply to team sites (WSS3 sites), not MOSS publishing sites.

Field definition schema:

Site columns are created by placing <Field> elements inside an <Elements> tag. It is important to review the <Field> element definition before going any further. The complete schema definition is detailed in the WSS3 SDK which can be consulted online on the MSDN site (http://msdn2.microsoft.com/en-us/library/ms437580.aspx). On the mentioned URL you can find all the types of fields available out of the box, the required attributes, possible values and so forth.

This is very good documentation for WSS3 fields but information on extra field types for publishing site columns is not available. At least I was unable to find it in the MOSS SDK or online. My solution was to look at the feature definitions used by MOSS publishing feature available out of the box.

Most of the attributes of the <Field> element are optional. This is a sample field definition using the most common attributes:

<Field

ID=”{4C67267C-B950-4cd4-8038-DEACA9EC2F74}”
Name=”IntroductionText”
StaticName=” IntroductionText ” SourceID=”http://schemas.microsoft.com/sharepoint/v3″
Group=”My publishing fields group”
DisplayName=”Introduction text field”
Type=”Text”
Required=”FALSE”
Sealed=”TRUE”
MaxLength=”250″>

</Field>

When using other types of fields there are extra attributes that are useful.

A note about the sealed attribute: setting this to “TRUE” will ensure the field cannot be removed via the “Change column” page. However when you are creating a choice field (a dropdown, a checkbox list), and you want your users to be able to edit the list of values you need to set sealed to FALSE.

Some attributes are only used in combination with some types of fields, like for example the StorageTZ attribute, which is useful together with Type=”DateTime”.

When it comes to publishing field types there are some new types that you can use. As far as I could find they are not yet documented. By looking at the “PublishingResources” hidden feature I could find the following:

Field type Description Related attributes
Image Publishing field for storing an image. The edit control shows the Insert picture button. RichText=”TRUE”
RichTextMode=”FullHtml”
HTML HTML editing control RichText=”TRUE” RichTextMode=”FullHtml”
Link Hyperlink control

In edit mode, allows the user to select an internal file (also external links can be allowed)

In display mode shows the clickable link to the file

RichText=”TRUE” RichTextMode=”FullHtml”
SummaryLinks Field control for editing a list of links

There are also some extra fields that are related to the page publishing content types such as “Publishing schedule start date”. I don’t think you’d like to use these as the page content types normally already inherit these types of columns.

As a sample for this and the following posts in this series I’m creating a product page content type. My product contains 8 fields going from name and description, date, image, price.

This is the XML schema (myfields.xml):

<?xml version=”1.0″ encoding=”utf-8″ ?>
<!– _lcid=”1033″ _version=”12.0.4017″ _dal=”1″ –>
<!– _LocalBinding –>
<!–
–>
<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”>
<Field ID=”{F44BFBB0-4725-4167-B976-F85F84131AA3}” Name=”ProductCategory” StaticName=”ProductCategory” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ Group=”$Resources:column_group_products;” DisplayName=”$Resources:column_productcategory_displayname;” Type=”Choice” Format=”Dropdown” Required=”FALSE” Sealed=”FALSE”>
<CHOICES>
<CHOICE>$Resources:column_productcategory_choice1;</CHOICE>
<CHOICE>$Resources:column_productcategory_choice2;</CHOICE>
<CHOICE>$Resources:column_productcategory_choice3;</CHOICE>
</CHOICES>
</Field>
<Field ID=”{EB19D87C-5DEE-4a73-85E0-506293D422D9}” Name=”ProductName” StaticName=”ProductName” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ Group=”$Resources:column_group_products;” DisplayName=”$Resources:column_productname_displayname;” Type=”Text” Required=”TRUE” Sealed=”TRUE” MaxLength=”255″></Field>
<Field ID=”{D73843E5-0D9F-4400-BC75-1A4C2BD27900}” Name=”ProductIntro” StaticName=”ProductIntro” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ Group=”$Resources:column_group_products;” DisplayName=”$Resources:column_intro_displayname;” Type=”Text” Description=”$Resources:column_intro_description;” Required=”TRUE” Sealed=”TRUE” MaxLength=”500″ NumLines=”2″></Field>
<Field ID=”{894635F9-1DF8-46f1-BC47-46EFF09FEF3D}” Name=”ProductDescription” StaticName=”ProductDescription” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ Group=”$Resources:column_group_products;” DisplayName=”$Resources:column_productdesc_displayname;” Type=”HTML” Required=”FALSE” Sealed=”TRUE” RichText=”TRUE” RichTextMode=”FullHtml”></Field>
<Field ID=”{D89C9409-2A97-4a7a-81F5-7D45E7CD8D6B}” Name=”LaunchDate” StaticName=”LaunchDate” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ Group=”$Resources:column_group_products;” DisplayName=”$Resources:column_date_displayname;” Type=”DateTime” Format=”DateTime” Required=”TRUE” Sealed=”TRUE” StorageTZ=”UTC”></Field>
<Field ID=”{6036ECDE-521A-4dbe-94B4-40E0E4EF7029}” Name=”ProductImage” StaticName=”ProductImage” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ Group=”$Resources:column_group_products;” DisplayName=”$Resources:column_image_displayname;” Type=”Image” Required=”FALSE” Sealed=”TRUE” RichText=”TRUE” RichTextMode=”FullHtml”></Field>
<Field ID=”{6A08E31A-0620-45df-BAC1-54A4D0FBFDCE}” Name=”ProductManual” StaticName=”ProductManual” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ Group=”$Resources:column_group_products;” DisplayName=”$Resources:column_manual_displayname;” Type=”Link” Required=”FALSE” Sealed=”TRUE” RichText=”TRUE” RichTextMode=”FullHtml”></Field>
<Field ID=”{F31DF817-D220-4449-BD6F-2F1B7C0823ED}” Name=”ProductPrice” StaticName=”ProductPrice” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ Group=”$Resources:column_group_products;” DisplayName=”$Resources:column_productprice_displayname;” Type=”Currency” Required=”TRUE” Sealed=”TRUE” Decimals=”2″></Field>
</Elements>

To install the field definitions via a feature I’m creating a feature.xml file that refers to the myfields.xml. In the feature file I also add a dependency to the PublishingSite feature.

A note about resources files:

As you may notice in the display name and description attributes I’m referring to a resource instead of typing in the text. I recommend using resource files whenever translatable (non system name) text is used.

Living in Belgium, a country where we have three official languages I’m used to creating multi-lingual applications. Even when a first requirement does not specify a multi-lingual approach I still prefer to foresee resource files.

When creating features you can use local resource files by placing them in a sub-folder in the feature directory.

MOSS5 / Create a Page Layout in Sharepoint

Saturday, June 7th, 2008

SharePoint team and Project server team at offshoresoftwaredevelopmentindia.com has great experience of creating web application based on MOSS 2007 and Project server 2007. That includes customization and development of webpart, site definitions, theme development, extension development, module creation. The team has developed CRM application, Job portal, Project management, to CMS applications based on MOSS 2007 and project server 2007.

Team would like to share same experience. This can help who wanted to begin with the sharePoint development and Project Server development.

There are list of articles start with SP and from number 1 to …. Always start with the article SP1 and read next article to start working on MOSS easily and quickly.

How to create a Page Layout in Sharepoint?

Page layouts are templates that define content structure for a page and are always associated with a content type. A content type contains a document template, data columns, workflows, and other information that completely define a document. The publishing feature of MOSS uses a single root content type for publishing called Page. All of the page layouts inherit from this base. Here’s how to create a new page layout in MOSS.

STEP 1:- Define Site Columns

The individual content elements that appear in a page layout are derived from site columns. When you create a page layout, you can use any of the site columns already defined or define your own.

STEP 2:- Define a Content Type

Page layouts have a direct relationship to a content type defined within the site. The content type is a collection of site columns, a page template, workflows, and other information that determine the appearance and behavior of a page layout. In order to create a page layout, you must create a new content type that derives from the existing Page content type. Inheriting the Page content type allows the new page layout to function correctly within the MOSS content management Feature.

STEP 3:- Create the Page Layout

Page layouts are stored in Master Page and Page Layout Gallery. From this gallery, you can create a new page layout and associate it with a content type. This process makes the site columns that are defined for the content type available to the page layout as field controls that you can place on the page with the SharePoint Designer.

STEP 4:- Edit the Page Layout in SharePoint Designer

Once you have created the new page layout, you must open it in the SharePoint Designer so that you can add the desired field controls. The site columns you defined as part of the content type become available in the SharePoint Designer as field controls that you can place on the page layout.

STEP 5:- Publish the New Page Layout

Once the page layout is created, you must publish and approve it so that it becomes available for content authors. This process is essentially the same as publishing any item in MOSS. First the document is checked in, then it is published, and finally it is approved.

STEP 6:- Create a New Page

Once the page layout is published and approved, content authors may use it to create new pages. This is done in the normal way by selecting the Create Page item from the Site Actions menu. After the page is created, the field controls may be edited to develop the actual page content.

MOSS4 / Create Minimal Master Page for SharePoint

Wednesday, May 14th, 2008

SharePoint team and Project server team at offshoresoftwaredevelopmentindia.com has great experience of creating web application based on MOSS 2007 and Project server 2007. That includes customization and development of webpart, site definitions, theme development, extension development, module creation. The team has developed CRM application, Job portal, Project management, to CMS applications based on MOSS 2007 and project server 2007.

Team would like to share same experience. This can help who wanted to begin with the sharePoint development and Project Server development.

There are list of articles start with SP and from number 1 to … Always start with the article SP1 and read next article to start working on MOSS easily and quickly.

How to Create Minimal Master Page for MOSS:

Go to Site Action -> Site setting -> Modify All Site Settings.

Then you will see the following screen. Then click on

Galleries -> Master pages and page layouts

You will see page as following image.

Click on default.master, it opens pop up then click send to -> Download a Copy

Save it to local drive. Rename defalt.master to maven.master. (Your referred name)

Then click on upload link.

Create Minimal Master Page

On clicking upload link following page will be displayed. Click browse, select .master file we have renamed and click ok.

Create Minimal Master Page

After clicking Ok, you will see following page. Select Content Type Publishing Master Page. Add the name and description. And click check in.

Create Minimal Master Page

Click on maven.master. we will see popup menu. Click on check out to make master page writable. Then click on maven.master, from popup click edit in Microsoft office sharepoint designer.

Create Minimal Master Page

This will open sharepoint server. Give the username and password of the site. The code of the current maven.master will be open.

Create Minimal Master Page

Replace code of the current maven.master with following code.


<%– Identifies this page as a .master page written in Microsoft Visual C# and registers tag prefixes, namespaces, assemblies, and controls. –%>
<%@ Master language=”C#” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<%@ Import Namespace=”Microsoft.SharePoint” %>
<%@ Register Tagprefix=”SPSWC” Namespace=”Microsoft.SharePoint.Portal.WebControls” Assembly=”Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”SharePoint” Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”WebPartPages” Namespace=”Microsoft.SharePoint.WebPartPages” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”PublishingWebControls” Namespace=”Microsoft.SharePoint.Publishing.WebControls” Assembly=”Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”PublishingNavigation” Namespace=”Microsoft.SharePoint.Publishing.Navigation” Assembly=”Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register TagPrefix=”wssuc” TagName=”Welcome” src=”~/_controltemplates/Welcome.ascx” %>
<%@ Register TagPrefix=”wssuc” TagName=”DesignModeConsole” src=”~/_controltemplates/DesignModeConsole.ascx” %>
<%@ Register TagPrefix=”PublishingVariations” TagName=”VariationsLabelMenu” src=”~/_controltemplates/VariationsLabelMenu.ascx” %>
<%@ Register Tagprefix=”PublishingConsole” TagName=”Console” src=”~/_controltemplates/PublishingConsole.ascx” %>
<%@ Register TagPrefix=”PublishingSiteAction” TagName=”SiteActionMenu” src=”~/_controltemplates/PublishingActionMenu.ascx” %>
<%– Uses the Microsoft Office namespace and schema. –%>
<html>
<WebPartPages:SPWebPartManager runat=”server”/>
<SharePoint:RobotsMetaTag runat=”server”/>

<%– The head section includes a content placeholder for the page title and links to CSS and ECMAScript (JScript, JavaScript) files that run on the server. –%>
<head runat=”server”>
<asp:ContentPlaceHolder runat=”server” id=”head”>
<title>
<asp:ContentPlaceHolder id=”PlaceHolderPageTitle” runat=”server” />
</title>
</asp:ContentPlaceHolder>
<Sharepoint:CssLink runat=”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderAdditionalPageHead” runat=”server” />
</head>

<%– When loading the body of the .master page, SharePoint Server 2007 also loads the SpBodyOnLoadWrapper class. This class handles .js calls for the master page. –%>
<body onload=”javascript:_spBodyOnLoadWrapper();”>
<%– The SPWebPartManager manages all of the Web part controls, functionality, and events that occur on a Web page. –%>
<form runat=”server” onsubmit=”return _spFormOnSubmitWrapper();”>
<wssuc:Welcome id=”explitLogout” runat=”server”/>
<PublishingSiteAction:SiteActionMenu runat=”server”/>
<PublishingWebControls:AuthoringContainer id=”authoringcontrols” runat=”server”>
<PublishingConsole:Console runat=”server” />
</PublishingWebControls:AuthoringContainer>
<%– The PlaceHolderMain content placeholder defines where to place the page content for all the content from the page layout. The page layout can overwrite any content placeholder from the master page. Example: The PlaceHolderLeftNavBar can overwrite the left navigation bar. –%>
<asp:ContentPlaceHolder id=”PlaceHolderMain” runat=”server” />
<asp:Panel visible=”false” runat=”server”>
<%– These ContentPlaceHolders ensure all default SharePoint Server pages render with this master page. If the system master page is set to any default master page, the only content placeholders required are those that are overridden by your page layouts. –%>
<asp:ContentPlaceHolder id=”PlaceHolderSearchArea” runat=”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderTitleBreadcrumb” runat=”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderPageTitleInTitleArea” runat=”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderLeftNavBar” runat=”server”/>
<asp:ContentPlaceHolder ID=”PlaceHolderPageImage” runat=”server”/>
<asp:ContentPlaceHolder ID=”PlaceHolderBodyLeftBorder” runat=”server”/>
<asp:ContentPlaceHolder ID=”PlaceHolderNavSpacer” runat=”server”/>
<asp:ContentPlaceHolder ID=”PlaceHolderTitleLeftBorder” runat=”server”/>
<asp:ContentPlaceHolder ID=”PlaceHolderTitleAreaSeparator” runat=”server”/>
<asp:ContentPlaceHolder ID=”PlaceHolderMiniConsole” runat=”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderCalendarNavigator” runat =”server” />
<asp:ContentPlaceHolder id=”PlaceHolderLeftActions” runat =”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderPageDescription” runat =”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderBodyAreaClass” runat =”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderTitleAreaClass” runat =”server”/>
<asp:ContentPlaceHolder id=”PlaceHolderBodyRightMargin” runat=”server” />
</asp:Panel>
</form>
</body>
</html>


Above code is default code for any master pages. Whatever our design we need, code it in this file. There is one content place holder which holds the page layout.

Save the file. Then go to master page and layouts page from the site as follows.

Create Minimal Master Page

Click on maven.master and click check in. This will open following page. Select Major Version (publish). And click open.

Create Minimal Master Page

Again click maven.master and click Approve/Reject from popup. And click approve.

Create Minimal Master Page

To change the master page of current site, go to;

Site action -> site settings -> modify all settings

Look and Feel -> Master page

This will open following form,

Create Minimal Master Page

Select maven.master.
This will apply maven.master to current site.

Fore more details please refer:

http://msdn2.microsoft.com/en-us/library/aa660698.aspx

  • QUICK QUOTE

     

    cforms contact form by delicious:days

  • CLIENT SPEAKS

    The team at Maven Infosoft has been simply awesome, they provide a great service and are easy to communicate remotely with and have a quick response time.


Country
State / County
City