Create a normal cs file for the web part. To deploy it, create 2 files in the feature folder - Feature.xml, elements.xml and webpart.webpart
wpchat.webpart---------------------------------------
webParts
webPart xmlns="http://schemas.microsoft.com/WebPart/v3"
metaData
type name="Eversheds.InstantMessaging.WebParts.WPChat, Eversheds.InstantMessaging, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=b0c7276684f0a390 "/type
importErrorMessageCan not import WPChat/importErrorMessage
/metaData
data
properties
property name="Title" type="string"IT Service Desk/property
property name="Description" type="string"A web part which allows the user to chat /property
property name="MissingAssembly" type="string"Cannot import this Web Part./property
property name="DisplayName" type="string"IT Service Deskproperty
property name="Name" type="string"ITServiceDesk/property
property name="AllowHide" type="bool"False/property
property name="AllowClose" type="bool"False/property
property name="ChromeType" type="chrometype"None/property
property name="AllowZoneChange" type="bool"True/property
property name="Hidden" type="bool"False/property
property name="AllowMinimize" type="bool"False/property
property name="AllowEdit" type="bool"True/property
/properties
/data
/webPart
/webParts
Feature.xml ---------------
?xml version="1.0" encoding="utf-8"?
Feature Id="D34D00B1-EC5C-4da8-8C50-009CB4B8BB42"
Title="IMCHATFEATURE"
Description="This is the chat Webpart"
Version="12.0.0.0"
Hidden="FALSE"
Scope="Site"
ReceiverAssembly="Eversheds.InstantMessaging, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=b0c7276684f0a390 "
ReceiverClass="Eversheds.InstantMessaging.FeatureReceiver.ReceiverChatFeature"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/"
ElementManifests
ElementManifest Location="elements.xml"/
ElementFile Location="WPChat.webpart" /
/ElementManifests
/Feature
Element.xml--------------------
?xml version="1.0" encoding="utf-8" ?
Elements xmlns="http://schemas.microsoft.com/sharepoint/"
Module Name="WebPartPopulation" Url="_catalogs/wp" RootWebOnly="TRUE" List="113"
File Url="WPChat.webpart" Type="GhostableInLibrary"
/File
/Module
/Elements
Deploy this using wsp and the web part can be added to the web part gallery.
Thursday, March 17, 2011
Tuesday, March 1, 2011
Create custom page layout using Feature
If you want to create a custom page layout using features in your solution, use the below steps-
Create a folder structure as -
12----
Template---
Features------
ABCPageLayout---
layout.aspx
Feature.xml
Elements.xml
layout.aspx-----------------------------
First create the entire layout in sharepoint designer and copy paste into .net aspx file.
Feature.xml-----------------------------
Feature Id="8C463F26-AE3C-4309-A284-AC095EB351A9"
Title="ABCPageLayout"
Description="page layoutt for use"
Version="12.0.0.0"
Scope="Site"
Hidden="True"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/"
ElementManifests
ElementManifest Location="ProvisionedFiles.xml"/
/ElementManifests
/Feature
Elements.xml---------------------------------
Module Name="OSGPageLayouts" Url="_catalogs/masterpage" Path="PageLayout" RootWebOnly="TRUE"
File Url="ABCPageLayout.aspx" Type="GhostableInLibrary"
Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" /
Property Name="PublishingAssociatedContentType" Value=";#$Resources:cmscore,contenttype_articlepage_name;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D;#"/
/File
Deploy this as a feature and your page layout will automatically go to the sharpoint pagelayouts.
Create a folder structure as -
12----
Template---
Features------
ABCPageLayout---
layout.aspx
Feature.xml
Elements.xml
layout.aspx-----------------------------
First create the entire layout in sharepoint designer and copy paste into .net aspx file.
Feature.xml-----------------------------
Feature Id="8C463F26-AE3C-4309-A284-AC095EB351A9"
Title="ABCPageLayout"
Description="page layoutt for use"
Version="12.0.0.0"
Scope="Site"
Hidden="True"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/"
ElementManifests
ElementManifest Location="ProvisionedFiles.xml"/
/ElementManifests
/Feature
Elements.xml---------------------------------
Module Name="OSGPageLayouts" Url="_catalogs/masterpage" Path="PageLayout" RootWebOnly="TRUE"
File Url="ABCPageLayout.aspx" Type="GhostableInLibrary"
Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" /
Property Name="PublishingAssociatedContentType" Value=";#$Resources:cmscore,contenttype_articlepage_name;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D;#"/
/File
Deploy this as a feature and your page layout will automatically go to the sharpoint pagelayouts.
Feature to create page of a page layout type
In case you want to create a page of a certain page layout in your solution folder, Follow the below steps.
First create the page layout in your solution using feature. (Steps in another post)
Create a structure as below in your solution -
12 --
Template --
Features ---
Page123-----
Elements.xml
Feature.xml
TemplatePage.aspx
Elements.xml------------------------
Elements xmlns="http://schemas.microsoft.com/sharepoint/"
Module Name="PublishingHomePage" Url="$Resources:cmscore,List_Pages_UrlName;" Path=""
File Url="TemplatePage.aspx" Name="Welcome.aspx" Path="TemplatePage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE"
Property Name="Title" Value="Online Services" /
Property Name="ContentType" Value="Article Page" /
Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/HomePageLayout.aspx, /sites/onlineservices/_catalogs/masterpage/HomePageLayout.aspx" /
/File
/Module
/Elements
Feature.xml----------------------------------
Feature Id="523E7D1F-052A-42e6-BD85-3ACFC82831EE"
Title="Page123"
Description="Home Page"
Version="1.0.0.0"
Scope="Site"
Hidden="True"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/"
ElementManifests
ElementManifest Location="Elements.xml"/
ElementFile Location="TemplatePage.aspx" /
/ElementManifests
/Feature
change the Feature id in your code.
TemplagePage.aspx--------------------- It is the normal templatepage in every site.
%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage, Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral, PublicKeyToken=71e9bce111e9429c" %
%@ Reference VirtualPath="~TemplatePageUrl" %
%@ Reference VirtualPath="~masterurl/custom.master" %
Deploy this as a feature and your page is ready.
First create the page layout in your solution using feature. (Steps in another post)
Create a structure as below in your solution -
12 --
Template --
Features ---
Page123-----
Elements.xml
Feature.xml
TemplatePage.aspx
Elements.xml------------------------
Elements xmlns="http://schemas.microsoft.com/sharepoint/"
Module Name="PublishingHomePage" Url="$Resources:cmscore,List_Pages_UrlName;" Path=""
File Url="TemplatePage.aspx" Name="Welcome.aspx" Path="TemplatePage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE"
Property Name="Title" Value="Online Services" /
Property Name="ContentType" Value="Article Page" /
Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/HomePageLayout.aspx, /sites/onlineservices/_catalogs/masterpage/HomePageLayout.aspx" /
/File
/Module
/Elements
Feature.xml----------------------------------
Feature Id="523E7D1F-052A-42e6-BD85-3ACFC82831EE"
Title="Page123"
Description="Home Page"
Version="1.0.0.0"
Scope="Site"
Hidden="True"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/"
ElementManifests
ElementManifest Location="Elements.xml"/
ElementFile Location="TemplatePage.aspx" /
/ElementManifests
/Feature
change the Feature id in your code.
TemplagePage.aspx--------------------- It is the normal templatepage in every site.
%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage, Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral, PublicKeyToken=71e9bce111e9429c" %
%@ Reference VirtualPath="~TemplatePageUrl" %
%@ Reference VirtualPath="~masterurl/custom.master" %
Deploy this as a feature and your page is ready.
Window.Unload() not working in IE6
I was not able to get this simple thing working in IE 6. It worked on IE7 and IE8 and not on IE6. I found the below workaround.
SCRIPT FOR="window" EVENT="onunload"
alert("on unload");
/SCRIPT
This works without any problem.
SCRIPT FOR="window" EVENT="onunload"
alert("on unload");
/SCRIPT
This works without any problem.
Subscribe to:
Posts (Atom)