SharePoint: 8 tips from the Trenches - PowerPoint PPT Presentation

1 / 63
About This Presentation
Title:

SharePoint: 8 tips from the Trenches

Description:

Designers can modify the XSL for web parts as well ... Style Library/XSL Style Sheets ... Add this XSL in your item style. CQWP with AllFields item style ... – PowerPoint PPT presentation

Number of Views:171
Avg rating:3.0/5.0
Slides: 64
Provided by: johnliuww
Category:

less

Transcript and Presenter's Notes

Title: SharePoint: 8 tips from the Trenches


1
SharePoint8 tips from the Trenches
  • John Liu

2
Agenda
  • Getting the design right
  • Configuring the Content Query web part
    AllFields item style
  • Performance tips for publishing sites
  • The dirty stuff package deployment
  • Removing manual configuration
    SPConfigModification
  • and in the darkness bind your Data CAML
  • The 3rd party tools
  • Debugging SharePoint in Visual Studio
  • Things we want for Microsoft SharePoint 2010

3
About John Liu
  • Senior Software Architect
  • SSW since 2001
  • Specializes in
  • ASP.NET Web Applications
  • Microsoft Office SharePoint
  • Built a few public SharePoint sites
  • WorleyParsons.com
  • MicrosoftSharePoint.com
  • And now spends quite a bit of time babysitting!
    (1 year old)
  • baby likes SharePoint too

4
What do you think SharePoint development is about?
  • This is what I thought, as an ASP.NET developer

Your web site (Intranet or Internet)
SharePoint
ASP.NET
5
What do you think SharePoint development is about?
  • This is what I think now, as a SharePoint
    developer

Full ASP.NET Customizations
CSS, Theme, Master Pages, Configurations
Custom Web-Parts
SharePoint
SharePoint
ASP.NET
6
The cost AWESOMENESS graph
Awesomeness ?
Full ASP.NET Customization
Custom Code/ Web-Parts
Master page, page layouts, Web Parts
Themes, CSS
Out of the Box
Cost, Time
7
  • WorleyParsons
  • Microsoft SharePoint
  • Agenda page

8
(No Transcript)
9
(No Transcript)
10
This is what it looks like originally
11
1. Getting the Design Right
Master page, page layouts
Themes, CSS
  • You should give your designers permissions to
    your development site and then let them loose
    with SharePoint designer!
  • This isnt as crazy as it sounds
  • start with a clean, minimal master page
  • Add your CSS as you go keep it clean

12
Start with a minimal master page
  • The minimal master page is a bare bones master
    page file from MSDN
  • It contains bare minimum content place holders
    and control tags to ensure SharePoint stays
    functional without crashing or throwing
    JavaScript errors

13
Upload the minimal master page to SharePoint
14
Add CSS registration reference
15
customize the design while keeping things clean
16
Getting the Design Right
  • Never modify the out of the box files
  • hard to deploy
  • Start from a clean, minimal master page
  • the SharePoint master page is a lot less
    intimidating this way
  • Create and reference your own CSS file put it in
    the style library
  • Designers can modify the XSL for web parts as
    well
  • not scary at all if you give them a starting
    point

17
next tip
  • SSW Employees page
  • This is done with a web part, what web part is
    this?

18
(No Transcript)
19
2. Configuring the Content Query web part
AllFields item style
  • The Content Query web part is very flexible
    allowing contents from different lists to be
    presented in different ways.
  • Use an AllFields item style to show all the
    fields in the current item Ill explain

CSS, Web Part
20
How do I
  • In SQL Server, if I want to select a list of all
    the field names
  • How do you know the names of the fields you
    look at it on query analyzer, or you do a quick
    select top 1
  • How to do this in SharePoint?

21
Add this XSL in your item style
  • /Style Library/XSL Style Sheets/
  • Take special notice of yellow it is essentially
    doing a SELECT
  • Use with CommonViewFields property add other
    fields to the CQWP

22
CQWP with AllFields item style
23
  • Now you can use the field to use it for something
  • ltdiv class"fancy"gt ltspangtltxslvalue-of
    select"Title"/gt lt/spangt ltimggt ltxslattribute
    name"src" select"ImageUrl"/gt lt/imggtlt/divgt

24
Web Parts customize (HIDDEN)
  • AuthenticatedPanel
  • ConditionalVisiblePanel

25
3. Performance tips for Publishing sites
  • Easy as cake configurations
  • Page output caching per cache profile
  • List Object caching options
  • Warning dont use with blob cache
  • Ive seen this truncate ghosted data

Configuration
26
Enable page output caching
27
The cache info footer
  • Public Internet (Purely Anonymous) cache profile
    defaults
  • 180 second
  • Does not check for changes
  • Vary by browser header
  • Cache on server and client.

28
next tip
  • SharePoint typically serves out very heavy HTML
    pages
  • Loaded with nested TABLE and difficult to style
    with CSS

29
4. Performance - hard
  • Hard customizations
  • Clean MasterPage, PageLayouts, XSL, CSS
  • CSS friendly adapters E.g. for menu
  • Web Part Zone adapters

CSS
Master page, page layouts
ASP.NET Customization
30
CSS Friendly menu adapter
  • Generated perfect ltLIgt menu

31
Wait theres still more!
  • Screenshot ActiveX control
  • Huge core.js

32
5. Performance - Extreme
  • Extremely Hard
  • HttpModule to reduce payload
  • This is an ASP.NET class that hooks onto the
    output stream so it is able to intercept
    SharePoint output via ASP.NET

ASP.NET Customization
33
HttpModule filter
34
6. The dirty stuff package deployment
  • How long should an SharePoint deployment take?
  • Steps
  • Add / update the package solution project
  • Run VSeWSS package
  • Deploy and test on staging server
  • Deploy and check on production server
  • Issues
  • New files not included in package
  • Files not checked-in
  • Wrong versions packaged

Custom Code
35
The dirty stuff deployment
  • What I would like is a tool that get latest
    versions of everything
  • Create tools to reduce manual steps
  • SSWPackageCompare.exe
  • Compares staging site with development and list
    missing files
  • Compares file differences
  • SSWPackageUpdater.exe
  • Updates Package files from development site
  • Tools are traditionally written as simple .NET
    applications
  • Q I didnt use PowerShell to write scriptlets,
    should I have used PowerShell?
  • SharePoint Object model is fine if you are on the
    same server, if you are crossing servers use
    SharePoint web service API

36
7. Removing manual configuration
SPConfigModification
Custom Code
  • When working with SharePoint, like in ASP.NET you
    often need to make changes to the web.config
  • SPConfigModification allows a feature to add
    changes to the web.config the scope is web
    application
  • These lines can be removed when the feature is
    de-activated

37
Show of hands
  • Q\ who wants manual vs. automatic

38
  • http//www.infragistics.com/hot/sharepoint.aspxSh
    arePoint
  • http//www.sharepointsecurity.com/blog/sharepoint/
    the-infragistics-sharepoint-demo-is-funny-but-depr
    essing/
  • I am not bagging on the controls, but if you
    are going to build a sample solution, MAKE IT
    EASY AND QUICK TO DEPLOY. I dont want to spend a
    afternoon trying to get some pie charts and
    random data grids into a demo site.

39
  • Picture - in the package there are many features
    each feature
  • Picture of the events
  • Which events wed use this one

40
Activate / deactivate the feature
41
Event FeatureActivated
42
Event FeatureDeactivating
  • Clear out any SPConfigModication created by the
    owner

43
WARNING Test your code
  • it will duplicate web.config if your XPath is
    incorrect

44
8. and in the darkness bind your Data CAML
  • CAML for site definition is great
  • CAML for query isnt so hot

Configuration
Custom Code
45
CAML 101
  • In SQLWHERE Status Completed OR Status IS
    NULL
  • Whats wrong with this CAML
  • ltQuerygt
  • ltWheregt
  • ltOrgt ltEqgt ltFieldRef name"Status" /gt
    ltValue Type"Text"gtCompletedlt/Valuegt lt/Eqgt
    ltIsNullgt ltFieldRef Name"Status" /gt
    lt/IsNullgt
  • lt/Orgt
  • lt/Wheregt
  • lt/Querygt
  • CAML (which is XML) is case sensitive Name
    attribute is incorrect lets try another one

46
CAML 101b
  • SQL SyntaxWHERE StatusCompleted OR
    StatusDraft OR Status IS NULL
  • How about this one?
  • ltQuerygtltWheregtltOrgt ltEqgt ltFieldRef Name"Status"
    /gt ltValue Type"Text"gtCompletedlt/Valuegtlt/Eqgt
    ltEqgt ltFieldRef Name"Status" /gt ltValue
    Type"Text"gtDraftlt/Valuegtlt/Eqgt ltIsNullgt
    ltFieldRef Name"Status" /gtlt/IsNullgt lt/Orgt
  • lt/Wheregtlt/Querygt
  • Or element does not accept three child elements.
    It expects and only accepts two.

47
Oh uh error!
  • How to catch a query error
  • I used to have an awesome tip about reading logs
    but now I have a better tip

48
9. The 3rd party tools
  • SharePoint ULS Log Parser
  • U2Us CAML Query Builder
  • Stramit CAML Viewer 2007
  • SharePoint YetAnotherCAMLQueryTool
  • .NET Reflector
  • SharePoint Manager 2007

49
  • Log directory looks like this

50
SharePoint ULS Log Parser 9/10
51
U2U CAML Query Builder 7/10
52
Stramit CAML Viewer 2007 -?/10
53
SharePoint YetAnotherCAMLQueryTool 7/10
  • Turns SQL syntax to CAML
  • Does nested syntax

54
.NET Reflector - 10/10
55
SharePoint Manager 2007 6/10
56
11. Debugging SharePoint in Visual Studio
  • The assembly DLL and the PDB symbols file
  • VS.NET 2008 symbols directory
  • Reading the output pane
  • Notes p.s. you are holding the server thread
    remember to let it go!

Custom Code
ASP.NET Customization
57
VS.NET tools options symbol locations
  • Add reference to bin\debug\

58
GAC assembly loaded with symbols
  • Reading the Output Pane

59
Debugging SharePoint process
  • Watch out you are holding the server thread

60
Things I want for Microsoft Office SharePoint
2010
  • A good acronym cant use MOSS anymore
  • IE8 Standards mode support
  • hopefully this is coming in service pack 2
    April 28th
  • Cleaner and lighter HTML code
  • Drop Active-X objects use more Silverlight 3
  • An easier package and deployment process
  • Self validation and error reporting
  • http//www.ssw.com.au/ssw/Standards/BetterSoftware
    Suggestions/SharePointTeamServices.aspx

61
Summary
  • Getting the design right
  • Configuring the Content Query web part
    AllFields item style
  • Performance tips for publishing sites
  • The dirty stuff package deployment
  • Removing manual configuration
    SPConfigModification
  • and in the darkness bind your Data CAML
  • The 3rd party tools
  • Debugging SharePoint in Visual Studio
  • Things we want for Microsoft SharePoint 2010

62
Resources
  • Minimal Master Page
  • http//msdn.microsoft.com/en-us/library/aa660698.a
    spx
  • http//sharepoint.ssw.com.au/Standards/RulesToBett
    erSharePoint/
  • http//www.ssw.com.au/ssw/Standards/BetterSoftware
    Suggestions/SharePointTeamServices.aspx
  • http//blogs.msdn.com/sharepoint/
  • http//www.codeplex.com/site/search?TagNameSharep
    oint

63
UTS Short Course
  • http//it.uts.edu.au/course/shortcourse/programmin
    g/SharePoint.html
  • http//it.uts.edu.au/course/shortcourse/ask/ShareP
    oint

64
2 things
  • JohnLiu_at_ssw.com.au
  • twitter.com/johnnliu

65
  • Thank You!
  • Gateway Court Suite 10 81 - 91 Military Road
    Neutral Bay, Sydney NSW 2089 AUSTRALIA
  • ABN 21 069 371 900
  • Phone 61 2 9953 3000 Fax 61 2 9953 3105
  • info_at_ssw.com.auwww.ssw.com.au
Write a Comment
User Comments (0)
About PowerShow.com