Monday, July 13, 2009

SharePoint Saturday Toronto Presentation

The first ever SharePoint Saturday Toronto conference organized by SharePoint Delivery was held on July 11th, 2009. For full coverage of the event see the article on sharepointdelivery.com.

I presented a session on "Content Query Web Part In The Wild" along with my colleague Tahir Nasir. The session was on how to customize the CQWP and build applications using it. As promised in the session, I am posting my PowerPoint presentation and demo script. The demo shows how to create an employee directory using the CQWP.

If you have any feedback about my presentation, please feel free to contact me. If your organization is looking for help with SharePoint please give me a call at 917-655-4948.

The presentation is at: http://sharepointdelivery.com/Documents/SharePoint%20Saturday%20Toronto/SharePoint%20Delivery%20-%20SharePoint%20Saturday%20Toronto%20-CQWP.pptx

Employee Directory Demo

Here are the steps to build an employee directory in MOSS.

1. Create a site for SharePoint Saturday Toronto using the team site template. Use its own top navigation. In the navigation settings check of show sub sites.

2. Create sites for IT, Sales, Employee Directory. Use the team site template.

3. In the site collection settings, create content type "SST Employee" that inherits from List -> Item.

4. In the SST Employee content type add the following existing fields:
Email, Business Phone

5. Create a new field called "SST Department".
values: IT, HR, Sales

6. In the Employee Directory site, create a custom list called Employees. In the list settings, add the SST Employee content type.

7. Create a new view called Employees and add the columns SST Department, Email, Business Phone. Reorder if necessary.

8. Populate the Employees List with the following data:
Hasan Shahid Sales hasan_pub*sharepointdelivery.com 917-655-4948
Tahir Nasir IT tahir_pub*sharepointdelivery.com 425-985-1549
Kanwal Khipple Sales kanwal_pub*sharepointdelivery.com 416-873-7799
Muhsin Shahid IT muhsin_pub*sharepointdelivery.com 416-629-4948
Amjad Ashraf IT amjad_pub*sharepointdelivery.com 248-890-4968


9. Go to the Employee Directory site main page and add the Employees web part. Set the view to the view that was created.

10. Go to the IT site and add the content query web part. Point it to the Employees list. Use the SST Employee content type. Enter condition for SST department field to contain "IT".

11. Export the Content Query Web Part. Edit the file. Search for the property "CommonViewFields". Edit the line to add the Work Phone and Email columns. Use the internal SharePoint column names. To find out the internal names, go to the Employees list settings and copy the URL from the link on the column name.

http://win2003/SST/ed/_layouts/FldEdit.aspx?List=%7B5C2A48F4%2DCEB0%2D4BAC%2D9B53%2D0E35A11F275B%7D&Field=WorkPhone
http://win2003/SST/ed/_layouts/FldEdit.aspx?List=%7B5C2A48F4%2DCEB0%2D4BAC%2D9B53%2D0E35A11F275B%7D&Field=EMail

So the internal names are WorkPhone, EMail.

Change the CommonViewFields property to the following:

<property name="CommonViewFields" type="string">WorkPhone,Text;EMail,Text</property>

Save the file and Import the web part file to the IT sales site.

12. In this step we need to create the XSLT to display the fields. In SharePoint Designer open up the site collection. Go to Style Library -> XSL Stylesheets. Check out the file ItemStyle.xsl.

Find the section xsl:template name="TitleOnly". Copy this and paste it at the end of the file before .
Edit this section and add this line before the final tag.

- <xsl:value-of select="@WorkPhone" /> - <xsl:value-of select="@EMail" />

Change the name to: SSTEmployees.

13. Now go back to the CQWP and change the web part settings. Under Presentation -> Item Styles select "SSTEmployees".

13. Repeat for the Sales site.


0 comments:

Post a Comment