Visit our SharePoint Forum

SharePoint developer? Submit Yourself as Freelancer

Monday, June 16, 2008

Creating and Deploying Event Reciver Feature with Solution package

See the new version @ Create and deploy Event Receiver Feature and Solution package


Requirenment was to fill in the value for Title column when a new item is added. The receiver was for calendar List(Templete Id 106).
Title coulmn should be filled in with pattren "CourseTitle( StartDateTime )" where CourseTitle was a Lookup field and StartDate Time was a default Start time field for Events List.

Steps:
1. Create a C# class Library Project.
2. Add Microsoft.sharepoint as reference.
3. Write the following Code for ItemAdded Event in class library project.

4. Sign the Project with a unique key and Build the Project.
5. Create a folder caled Featurefolder and create a xml file in that. Name the file as "EventReciversElement.xml".

6. The code for Elements file is below:

7. Create Another xml file in the same folder(Featurefolder) name it as feature.xml.
8. Below is the code for Feature.xml.


9. Now we will create a solution Package to bind this feature.
10. For creating solution package we need to create manifest.xml file.


11. Lastly, we need .ddf file to tell how to arrange the files(elements.xml,feature.xml,dll,aspx pages or images) in a solution .cab project.

12. Add a Text file and name it as EventReciver.ddf. Write the following text in ddf file :

.OPTION EXPLICIT ; Generate errors

.Set CabinetNameTemplate =EventReciver.wsp; //name of soultion package

.Set DiskDirectoryTemplate=CDROM; All cabinets go to same folder

.Set CompressionType=MSZIP; //All files compressed in cabinet files

.Set Uniquefiles="ON"

.Set Cabinet=no

.Set DiskDirectory1 = Package

manifest.xml manifest.xml

Featurefolder\feature.xml Featurefolder\feature.xml

Featurefolder\EventReciversElement.xml Featurefolder\EventReciversElement.xml

bin\Debug\EventReciverFeature.dll EventReciverFeature.dll

13. open the command prompt and navigate to the EventReciverFeature folder.

write makecab.exe /f EventReciver.ddf to create a .wsp file in a package folder in EventReciverFeature folder.

14. Deploy this solution with stsadm.exe in sharepoint enviornment.



See the new version of this post @ Create and deploy Event Receiver Feature and Solution package

Saturday, June 7, 2008

Javascript and CSS in XSLT

I had a requirenment to display a little tooltip like pop-up on mouseover(hoverover) of the Links(Single LineText) displayed using a DataView WebPart.The tooltip would contain description of the Link again puled in from the List.


Something like:
"Send Us Feedback" is a Title(named as Links) in the List and "Tell us what you think.." is Links description.
To do this we need to add a CSS for creating a tooltip in DataView's XSLT.
The List that I used had following columns:
1. Links
2. Descriptions
3. URL for the Link.

In Data view XSLT header put the following CSS for creating a tooltip pop-up

Refer the CSS class "link" to make a pop-up with description(defined in span)

So you get the POP-UP Now.
Another requirenment was to open up the Link("Send us the feedback" in this case) in a New window. The Url for new window is also pulled in from same List.
This is done by using the below code:


About XSLT
XSLT is a language for transforming XML documents into XHTML documents or to other XML documents.

XPath is a language for navigating in XML documents.
What is XSLT?
XSLT stands for XSL Transformations
XSLT is the most important part of XSL
XSLT transforms an XML document into another XML document
XSLT uses XPath to navigate in XML documents
XSLT is a W3C Recommendation
XSLT = XSL Transformations
XSLT is the most important part of XSL.
XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element.
With XSLT you can add/remove elements and attributes to or from the output file. You can also rearrange and sort elements, perform tests and make decisions about which elements to hide and display, and a lot more.
A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree.
XSLT uses XPath to find information in an XML document. XPath is used to navigate through elements and attributes in XML documents.
How Does it Work?
In the transformation process, XSLT uses XPath to define parts of the source document that should match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document.

SharePoint Programming