Sunday, 10 February 2008
How your permissions affect what you can see
Here's a simple overview of why -
http://sharepoint.microsoft.com/blogs/GetThePoint/Lists/Posts/Post.aspx?List=8d9e2a99%2Df288%2D47c2%2D916b%2D2f32864f7b82&ID=60
Tuesday, 5 February 2008
STSDEV is AWESOME
http://www.codeplex.com/stsdev
It's excellent and generates SharePoint code for you, it will also save a lot of development time. I advise all SharePoint developers to watch the video's on this page
http://www.codeplex.com/stsdev/Release/ProjectReleases.aspx?ReleaseId=10119
Start with -
1. STSDEV_01_Introduction.wmv: A basic introduction to the STSDEV utility which covers setup and usage including an exploration of the basic Visual Studio project structure that is generated for all STSDEV-generated solutions. You should view this screencast before any of the others.
Monday, 4 February 2008
Learn to talk to your CFO in their language - SharePoint 2007 Project Costing, Feasability, Planning and Governance
What am I talking about?
How much will this SharePoint 2007 project cost?
How much will this SharePoint 2007 project make/save me in the future?
When implementing massive SharePoint 2007 Projects there is a great deal of risk involved. SharePoint is great software, but at the end of the day its all about money, what is more important is how much will it cost? and how much will it make/save me in the future, you may not care about this if you are a technical person, but I bet management and the people paying you to work with SharePoint do!
Here's a rundown and the links, keep an eye out for my name in the WCM Scenario :)
http://www.cleverworkarounds.com/2007/11/17/learn-to-talk-to-your-cfo-in-their-language-part-1/
Assessing the value of an investment, the time effect on money, the concept discount cash-flow and some of the related calculations like Net Present Value (NPV) and Internal Rate of Return (IRR)
http://www.cleverworkarounds.com/2007/11/25/learn-to-talk-to-your-cfo-in-their-language-part-2/
Introduction to the various scenarios over this series Collaboration, WCM and Web Application. Explanation of methodology used, and assumptions made
http://www.cleverworkarounds.com/2007/11/28/learn-to-talk-to-your-cfo-collaboration-scenario-part-3/
The Collaboration Scenario
http://www.cleverworkarounds.com/2007/12/08/learn-to-talk-to-your-cfo-wcm-scenario-part-4/
The Web Content Management Scenario
http://www.cleverworkarounds.com/2007/12/09/learn-to-talk-to-your-cfo-web-application-scenario-part-5/
The Custom Web Application Scenario
Small Font Size in SharePoint Discussion Board
To fix this you need to identify the SharePoint CSS classes which are setting the Font size, I like to use the FireBug plug-in with Firefox (right-click and Inspect Element) to identify the overrides required then implement the CSS overrides in your custom Style Sheet to increase the font-size.
Vivid Group Launches Another MOSS 2007 WCM Public Internet Website - http://www.amanaliving.com.au
Features :
Low page weight, no core.js - This makes the site faster than most MOSS 2007 WCM websites
Completely custom Master Pages and Page Layouts primarily comprising custom server controls (including custom navigation controls) and SharePoint web controls
Font size switching, page print mode
Custom Search Center, Site map page
Random "Our People" (staff profiles with images) featured on home page, randomly loaded from a site list
Latest News and Upcoming Events on home page automatically rolled up from most recent dated pages in news and events subsites respectively.
Most of the website is configurable via use of site lists, including header and footer links, home page service profiles and facility features
Service Profile Pages (http://www.amanaliving.com.au/Information_and_Service_Centre/highcare/Pages/St_Georges_Home.aspx) hooked into Facility Features site lists with the use of Lookup Fields, to make editing content easier.
Developed in record time =oP with the use of a custom site definition ( well 2 custom site defs if you count the custom search center custom site definition ), custom list features, content type binding features, List Lookup Field re-creation, fields and content type features, master page and page layout features, custom site provisioning of sites and pages from an XML file etc. etc.
The best part of it is, it's all in source control, which helps provide greater re-use of code in future projects.
A nice easy MOSS 2007 WCM Project, a simple site without too many content types, or too many page layouts. Still, the site shows off what MOSS 2007 WCM can do, the site architecture is primarily built on custom site lists, and page layout content types and it makes use of Search.
Special Thanks to the great team at Vivid Group, especially -
Leah Dent (Project Manager)
Matt Cahill (System Planning and MOSS Farm Hosting Environment Infrastructure Setup)
Brad Carpenter (Designer)
Simon Mateljan (Designer)
Jonathon King (Designer)
Locking Down Styles in the MOSS Publishing HTML Field Control
Descriptions of these field control properties from the MOSS SDK - http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.publishing.webcontrols.richhtmlfield_members.aspx
Name
Description
AllowExternalUrls
Gets or sets the constraint that allows external URLs in the HTML when validating the value in this RichHtmlField object.
AllowFonts
Gets or sets the constraint that allows font element tags to be added to the HTML.
AllowHeadings
Gets or sets the constraint that allows heading tags to be added to the HTML.
AllowHtmlSourceEditing
Determines whether you can switch the HtmlEditor object into a mode where the HTML can be edited directly.
AllowHyperlinks
Gets or sets the constraint that allows hyperlinks to be added to the HTML.
AllowImages
Gets or sets the constraint that allows image tags to be added to the HTML.
AllowLists
Gets or sets the constraint that allows list tags to be added to the HTML.
AllowReusableContent
Gets or sets the flag that enables the reusable content picker button when editing this field.
AllowTables
Gets or sets the constraint that allows table handling tags to be added to the HTML.
AllowTextMarkup
Gets or sets the constraint that allows explicit text markup tags, such as bold and italic, to be added to the HTML.
What happens when they are set to FALSE?Eg. If I set AllowFonts="False" and AllowTextMarkup="False"It disables the font and text colour buttons on the HTML Editor.
If a content author pastes in HTML with Font tags or text mark-up in the field control and now attempts to save or check in the page :You get this on the Page Editing Toolbar -
And the HTML Field Control now contains an Auto Correct button and a message related to ‘unsupported formatting’Now simply click the Auto Correct button, and the content is cleaned up client side with javascript, nice What happens to the HTML?BEFOREFONT color=#ff8000 size=5>WesTrac has a huge range of reliable low hour used equipment, all meticulously prepared for resale. If you can’t find exactly what…AFTERWesTrac has a huge range of reliable low hour used equipment, all meticulously prepared for resale. If you can’t find exactly whatOne more thing…If you set any of these properties to false it won’t automatically go through and clean-up the content in your site, but if a page contains content with these tags, the next time a content author edits the page and tries to save or check-in this validation will kick-in and it won’t let the user save the page unless they click the button to clean up the HTML.
Copy and Pasting Content from Word DocumentsYou can still paste in content from Word Documents, and this won’t automatically clean-up that HTML, these settings only seem to affect explicit font tags or other text markup, not in-line styles…
You get the following icon showing up in the field control You can also access remove inline styles from the floating tool-bar BEFORE
Sezai’s pasting this content in from word!
AFTERSezai’s pasting this content in from word!
ConclusionThere is no AllowStyles or AllowInlineStyles property! That’s dumb because I can paste in content from word that is setting Font and Font Colour with inline styles !That means even though I have set the following properties to false AllowFonts="False" and AllowTextMarkup="False" I can still set different fonts and font colours in Word, then paste it into a page, and save and check-in the page !!! and MOSS will let me… you need to remember to always click the Remove Inline Styles explicitly.Creating a Standards Compliant MOSS 2007 WCM Public Internet Website With Low Page Weight
Some of you may wonder how in heck are people making MOSS 2007 render these sites with such small page weight, that are compliant?
We're currently developing a Federal Government website that is required to be XHTML Compliant and we (http://www.sharepointblogs.com/tommysegoro) have spent heaps of time investigating various ways to reduce page size and unnessesary rendering.
A public WCM website rarely needs to make use of web parts so you don't need most of what is in the HTML of a standard MOSS master page such as that 200kb+ Core.JS! Why make everyone who browses to a site download 200kb .JS file that they don't need or use! That's just dumb.
You can simply wrap and hide most MOSS CSS and JS references using a custom panel control so they don't render when the user is anonymous, a SPSecurityTrimmedControl can also be used for this purpose. You still need all of that SharePoint JS and CSS if the user is authenticated and authoring, so the Site Actions, PET and Field Controls render and function correctly, but all that heavy JS and CSS is not required for the anonymous user.
The Master Page and Page Layouts are developed from a minimal.master (that has been further minimalised) and starts off completely empty and FULLY compliant, then start adding field controls and custom controls. All controls make use of the MOSS object model to get data from Page Fields for content specific to the page and Site Lists which provide an easy way for content authors to configure common elements across all pages in the site, like header and footer links. Ensure each custom control added renders its html nicely and doesn't break compliance in the page! You can also do some funky .NET code in Master Pages and Page Layouts to further strip out HTML on rendering to have extra control to ensure compliance for the anonymous user.
Think about page 'Modes' to help make it easy when developing, the anonymous user just needs a simple html page, where as someone running the site and authoring content needs all the SharePoint stuff to work. You can check the page mode programatically and also make use of Edit Mode Panels to control rendering in edit mode and display mode.
PAGE AND AUTHENTICATION MODES
1. Edit Mode and Authenticated
In Edit mode authors need to be able to interact with field controls on the page to change content on the page. You also need the Site Actions menu, PET, and the SharePoint JS and CSS to be in the page for the author to do their job. You can forrget now about making Edit Mode XHTML compliant, but that's okay because the public won't ever see edit mode, only the web authors will, and this page doesn't need to be compliant, it needs to primarily be functional to facilitate entering content and configuring the page, so feel free to use whatever html you want to. Page size will also be massive with core.js but that's okay
2. Display Mode and Authenticated When the author checks-in the page after editing or they browse through the site authenticated they aren't presented with field controls, but with a page that looks fairly similar to what the anonymous users will see, with important exceptions, the Welcome Sign-In, Site Actions menu, PET and the SharePoint JS and CSS must be in the page for the author to do their job. Depending on security, this mode will see present the current edited page that is pending approval, so authors can trigger page workflows by clicking the PET buttons to approve pages.
3. Display Mode and Anonymous
Must be compliant, with nice html and small page size. You don't need any of that SharePoint JS or CSS, and the anonymous user defanetly aint gonna be clicking the site actions menu, PET or entering content because they won't be there! This should render as close to the HTML/CSS Design provided by the Designer (which should probably be compliant!) If you are still having problems with compliance, you can also kick in some further in-line custom .NET code in the Master Page to further manipulate the HTML rendered by overriding the Page.Render method.
So you basically need to build three seperate and independant web interfaces, by developing with page modes in mind it frees you to do what is required for that specific page mode, I have previously been frustrated with MOSS WCM Development and trying to produce clean html while still, at the same time make all the SharePoint controls function correctly, by thinking about page mode you can free yourself of the dirty rendering that OOTB SharePoint web controls when in anonymous mode and get rid of dependencies on MASSIVE un-needed JS and CSS that fatten the page size. If you are building a public internet web site, then page size should be small with simple html, css and js so that its FAST, because no one likes a SLOW website!
A problem with this approach outlined is it involves extensive development work on custom .NET controls, you need to build a lot more yourself, because guess what! The OOTB search center needs that SharePoint JS for buttons and stuff to work :( and all the Search controls are Web Parts, So you need to build a Custom Search Center site yourself that uses custom page layouts with no web parts.
I'm a big fan of going fully custom, because in the real world requirements for a standards compliant public Internet website aren't met by MSFTs cookie-cutter approach to MOSS web controls, and page rendering, you can save time when developing with custom controls because trying to configure and mess with sharepoint web controls and web parts will waste a lot more time than coding simple controls that use the object model to get Page Field data and Site List data, and then render what you want them to (for me anyways) BE CAREFUL!!! custom code means you can potentially code something nasty that will hammer sql or the cpu, be sure to dispose of objects properly. If you write custom controls you need to take responsibility for their efficiency and what they do to server resources. Also remember to enabled BLOB cache to further improve performance and try and investigate application caching when custom controls take long to do their work to get the data they need to render.
Lists can help improve productivity compared to classic ASP.NET development against a database data layer, I love lists because of all the cool free stuff that comes with them, but that development time saved is quickly eaten up by a lot of the other time wasting aspects of MOSS 2007 development such as deployment. Win Some Lose Some.
Some Code
How do you tell if you are in edit or display mode?
Get SPContext.Current.FormContext.FormMode and check this against the Microsoft.SharePoint.WebControls.SPControlMode enumeration.http://www.sharepointblogs.com/sezai/archive/2007/08/29/spcontext-current-formcontext.aspx
How do you tell if the user is authenticated?
HttpContext.Current.Request.IsAuthenticated
For an example see the RegisterCoreWhenAuthenticatedControl here http://blogs.msdn.com/ecm/archive/2007/02/21/building-a-new-page-layout-which-does-not-reference-core-js-but-downloads-it-while-the-page-is-being-viewed-thereby-optimizing-response-time.aspx
More Linkage
Excellent and Inspirational Blog Posts on MOSS 2007 Compliant websites, with heaps of steps I followed!http://zac.provoke.co.nz/archive/2007/04/19/guide-to-making-sharepoint-xhtml-compliant.aspxhttp://blog.thekid.me.uk/archive/2007/05/01/another-day-another-accessible-moss-website.aspxhttp://blog.thekid.me.uk/archive/2007/05/08/getting-sharepoint-to-produce-the-html-you-want.aspx
Blog Post on using custom HTTP-Filter to clean HTML output to reduce page size and possibly enforce compliance http://www.ie-soft.de/blog/CommentView,guid,968b0588-f306-467b-be51-54f7a8f2079d.aspx
see sections Get the Space Out – Reducing Page Size Over the Internet Pipe JavaScript Weight Reduction – The Client Browser http://blogs.msdn.com/sharepoint/archive/2007/07/19/moss-has-got-game-glu-mobile-s-website-www-glu-com-how-we-did-it-part-3-of-3.aspx
How to Optimize a SharePoint Server 2007 Web Content Management Site for Performancehttp://msdn2.microsoft.com/en-us/library/bb727371.aspx
Definetly something to look out for AKS Accessibility Kit for SharePoint - http://blogs.msdn.com/sharepoint/archive/2007/09/05/pre-announcing-the-accessibility-kit-for-sharepoint-aks.aspx
Going Down The Rabbit Hole - The MOSS 2007 Publishing Site Definition
Soon after I realised the trouble and pain you could get yourself into if you don't use the feature and solution framework. In the aim to work 'fast' and finish your development tasks quickly, you can fall into a massive trap and realise that although it takes plenty of effort to develop Features, in the long term you are better off because of RE-USE of features and ease of DEPLOYMENT. All developers love reusing their work, it saves time in the long run, and you don't have to constantly re-do the same thing like a robot. When you deploy you customisations to a production system, you don't always have SharePoint Designer available to hookup to the site, and you don't want to have to remember a dozen manual steps to repeat, more robot action, it also leaves room for human error, and the Network/Systems Admin guys won't be happy with you, they want an atomic deployment process.
You can go one step further, develop your own Custom Site Definition, so you can allow users to create *custom* sites pre-populated with your Lists and other files, and the sites can have YOUR features enabled AUTOMATICALLY, sounds nice hey?
In the last few months I have been doing just that, so I thought I would document the following to help myself (and now YOU) understand what happens when sites are created in SharePoint and how the Features are enabled.
So what actually happens when you create a new Publishing Site ?Whenever you create any site in SharePoint, XML files in the 12 Hive are used in the process to create the site, the various XML files contain information and settings needed to provision sites as well as references to dependent Features that are also activated on Site Collection creation or Web Creation. The Folder ’12-hive’\TEMPLATE\1033\XML Contains the file webtempsps.xmlThe file contains some of the following related to Publishing Sites, the BLANKINTERNETCONTAINER template is used to create a new Publishing Site Collection
What is VisibilityFeatureDependency ?
There are Feature IDs referenced in the VisibilityFeatureDependency attribute
The F6924D36-2FA8-4f0b-B16D-06B7250180FA Feature ID refers to the PublishingSite feature and Feature ID 97A2485F-EF4B-401f-9167-FA4FE177C6F6 refers to the BaseSiteStapling feature. F6924D36-2FA8-4f0b-B16D-06B7250180FA - PublishingSite
This is the PublishingSite feature. This feature does nothing more than Activate four other features, it has the following ActivationDependencies
More feature IDs to lookup !A392DA98-270B-4e85-9769-04C0FDE267AA - PublishingPrerequisites
This is the PublishingPrerequisites feature which hooks up a Feature Event receiver. AEBC918D-B20F-4a11-A1DB-9ED84D79C87E - PublishingResources
This is the PublishingResources feature which provisions Site Columns, Content Types, Files and Resource settings
This is the Navigation feature which provisions custom actions and controls for Navigation D3F51BE2-38A8-4e44-BA84-940D35BE1566 - PublishingLayoutsThis is the PublishingLayouts feature which provisions files into the site. It provisions all Publishing Page Layouts, Master Pages, Page Layout Preview Images, Style library Images and Style Library CSS 97A2485F-EF4B-401f-9167-FA4FE177C6F6 - BaseSiteStapling
This is the BaseSiteStapling feature, it will staple several features to site definitions listed in the feature, it contains dozens of FeatureSiteTemplateAssociation nodes, it is interesting to note that :
Feature B21B090C-C796-4b0f-AC0F-7EF1659C20AE (BaseSite) is stapled to the following site templates :STS#0 , STS#2 , MPS#0 , MPS#1 , MPS#2 , MPS#3 , MPS#4 , WIKI#0 , BLOG#0 , BDR#0 , EAWF#0 , OFFILE#0 , OFFILE#1 , PWA#0 , PWS#0 , SPS#0 , SPSMSITE#0 , SPSTOC#0 , SPSTOPIC#0 , SPSNEWS#0 , SPSNHOME#0 , SPSSITES#0 , SPSBWEB#0 , SPSCOMMU#0 , SPSREPORTCENTER#0 , SPSPORTAL#0 , SRCHCEN#0 , PROFILES#0 , CMSPUBLISHING#0
The BaseSite Feature is an ActivationDependency feature and activates the following Features
Feature 99FE402E-89A0-45aa-9163-85342E865DC8 (BaseWeb) is stapled to the following site templates :STS#0 , STS#2 , MPS#0 , MPS#1 , MPS#2 , MPS#3 , MPS#4 , WIKI#0 , BLOG#0 , BDR#0 , EAWF#0 , OFFILE#0 , OFFILE#1 , PWA#0 , PWS#0 , SPS#0 , SPSMSITE#0 , SPSTOC#0 , SPSTOPIC#0 , SPSNEWS#0 , SPSNHOME#0 , SPSSITES#0 , SPSBWEB#0 , SPSCOMMU#0 , SPSREPORTCENTER#0" , SPSPORTAL#0 , SRCHCEN#0 , PROFILES#0 , CMSPUBLISHING#0
The BaseWeb Feature is also an ActivationDependency feature and activates the following Features
Feature 541F5F57-C847-4e16-B59A-B31E90E6F9EA (NavigationProperties) is stapled to the SRCHCENTERLITE#1 site template with the following properties within the FeatureSiteTemplateAssociation
Which explains why the Search Centre Lite Navigation is different to navigation in all other site templates!
We have now traced through the VisibilityFeatureDendencies in webtempsps.xml, let us now get back to this file and continue this journey down the rabbit hole by exploring the SiteTemplates referenced.
The Folder ’12-hive’\TEMPLATE\SiteTemplates Contains a folder for each Site Template in the site. One such folder is BLANKINTERNET which contains an XML folder that contains a ONET.xml file.
This file contains the following configuration nodes, which contain Feature ids, so even more features can be activate on site creation, there are Site Features activated on Site Collection Creation and Web Features activated on Web (sub-site) Creation.
The following are site features activated on Site Collection creation
C85E5759-F323-4EFB-B548-443D2216EFB5 ExpirationWorkflow Feature
02464C6A-9D07-4F30-BA04-E9035CF54392 ReviewWorkflows Feature6C09612B-46AF-4B2F-8DFC-59185C962A29 SignaturesWorkflow FeatureC6561405-EA03-40A9-A57F-F25472942A22 TranslationWorkflow FeatureA392DA98-270B-4e85-9769-04C0FDE267AA PublishingPrerequisites Feature7C637B23-06C4-472d-9A9A-7C175762C5C4 ViewFormPagesLockDown FeatureAEBC918D-B20F-4a11-A1DB-9ED84D79C87E PublishingResources FeatureF6924D36-2FA8-4f0b-B16D-06B7250180FA PublishingSite Feature7AC8CC56-D28E-41f5-AD04-D95109EB987A OSSSearchCenterUrlSiteFeature Feature Publishing Web Features
The following is a list of all Web Features in the onet.xml file00BFEA71-DE22-43B2-A848-C05709900100 CustomList Feature00BFEA71-E717-4E80-AA17-D0C71B360101 DocumentLibrary Feature00BFEA71-52D4-45B3-B544-B1C71B620109 PictureLibrary Feature00BFEA71-A83E-497E-9BA0-7A5C597D0107 TasksList Feature00BFEA71-4EA5-48D4-A4AD-305CF7030140 WorkflowHistoryList Feature22A9EF51-737B-4ff2-9346-694633FE4416 Publishing Feature541F5F57-C847-4e16-B59A-B31E90E6F9EA NavigationProperties Feature94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB PublishingWeb Feature
Summary
This investigation demonstrates what actually happens when you create a publishing site in MOSS 2007. In summary, a series of features are enabled on the site collection, in a specific order. Features are also enabled when creating subsites.Why do we need this information ?
To create YOUR OWN Custom Publishing Site Definitions, so you have full control over what features are activated in your site, you can get into trouble if you do not activate features in the correct order, such as activating a feature that contains Page Layouts referencing a Content Type, if the Page Layout feature is enabled before the Content Type feature then the pages created will not be created correctly because of the dependency issue.
Extend The PublishingLayoutPage Class - Create Your Own to Run Code in the 'Page'
This will let you run your own custom code in the context of a page.
Do you miss putting code in the Page? I do!
This will kinda give you back some of that 'lost power'.
http://blogs.msdn.com/jannemattila/archive/2007/04/14/adding-functionalities-to-pages-by-inheriting-publishingpagelayout.aspx (awesome post that started me on this!)
microsoft.sharepoint.publishing.publishinglayoutpagehttp://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishinglayoutpage_members.aspx
You may notice that all MOSS WCM Page Layouts start with the following Inherits="Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c"
So if you create your own custom class, which inherits from PublishingLayoutPage you can then define your own methods and properties in it, do page level code like we used to do in MCMS !
You then switch the reference in you Page Layouts to use your new custom PublishingLayoutPage as described in Janne Mattila's EXCELLENT post.
I have tried this out and it works like a charm, I can now run code code when the page initialises, such as switch the Master Page used on loading the page, awesome.
Many Custom PublishingLayoutPage Classes, One for Each Page Layout ?
If you develop your own custom PublishingLayoutPage class then you can reference it in All your custom Page Layouts. The same custom code will now run in All Page Layouts.
To go one step further, develop many custom PublishingLayoutPage classes, one for each page layout you have, you can then run independent code for each Page Layout!
Even create your own Base PublishingLayoutPage class and inherit many custom classes from your base, this will give you the ability to run independent code for each page layout, AND also run common code for all Page Layouts in your Base PublishingLayoutPage class.
The possibilities are endless. My only regret is not trying this out sooner =o(
SPContext.Current.FormContext
http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spformcontext_members.aspx
FormContext has this super Method
1. SetFormMode Use it to change the current SPControlMode (haven't tried this out)
FormContext has two awesome Properties
1. FieldControlCollection - Get a collection of the Field Controls.
2. FormMode - Get the Current SPControlMode
What is SPControlMode?
http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spcontrolmode.aspx
Editing content in a MOSS Publishing Site is done “in context” ie. You navigate to a page, and “Edit” the page, after which the page "mode" switches and you are presented with data entry controls that let you enter data into page fields.
So a Page can be in different modes, very similar in concept to how MCMS 2002 functions.
So we need a nice way to determine the “SPControlMode” programmatically in custom code so we can control rendering (do cool stuff) when in different modes.
The SPControlMode enumeration contains these values -
Display, Edit, Invalid and New
Some example CODE that makes use of FormContext.FormMode -
' If Me not in Display Mode, Hide Me
If (SPContext.Current.FormContext.FormMode <> Microsoft.SharePoint.WebControls.SPControlMode.Display) Then
Me.Visible = False
End If
Feedback from the August Perth SharePoint User Group Meeting
I presented a session on MOSS 2007 WCM at the August Perth SharePoint User Group Meeting
Here is some feedback I have received since :
“The guys came back from your talk impressed with your depth of knowledge and experience on SharePoint.”
"I heartily endorse this product or service"
“It was a bit boring first 15 mins (it was just like Microsoft promotion) but the rest was fun. You did very well with Q&A at the end I think. Great job!”
"Man, this MOSS 2007 is the best thing since sliced bread, I guess that makes you a Bread Maker or some other type of Bread Machine?"
“its nice to see someone as passionate about MOSS and .NET development as you are.”
“Sezai, Sezai your so fine, you’re so fine you blow my mind, Go Sezai !”
“It was great to meet someone who is so enthusiastic and passionate about his work.”
"Dude, you are so sad, you need to find something else to get excited about instead of software, especially Microsoft software - Uber Nerd !"
“You are the Steve Irwin of SharePoint.”
It's hard work being such a Guru/Expert/Boffin/Grand Master/Legend in MOSS 2007 WCM, but someone has to do it !
Manage Solution Development Easier and Faster
This is done by manually updating two files, Manifest.xml and the .ddf file. So whenever I need to add a new file to a feature, or a new assembly, or anything new I want deployed with the solution i need to manually edit and update the Manifest.xml and the .ddf file.
This can be time consuming !
Then I came across this on Code Plex - WSP Builder
http://www.codeplex.com/wspbuilder built by the Carsten Keutman
If you setup your Visual Studio Solution folder structure to match the '12 hive' then this baby will generate a new solution ID, the Manifest.xml for you as well as the .wsp !
No more manually creating the manifest.xml file.No more manually specifying the DDF file.No more using the makecab.exe application.
Therefore you do not need the knowledge of how to create a solution manifest.xml and wsp file any more.
http://www.keutmann.dk/sharepointblog/wspbuilder/wspdemo.jpg
http://www.keutmann.dk/sharepointblog/wspbuilder/wspbuilderconsole.jpg
http://www.keutmann.dk/sharepointblog/wspbuilder/buildresult.jpg
AND ....
Head over to ACs blog! He has just started a new 5-part series about saving even MORE time when working with features and solutions.
Part 1: Announcing AC's VS CodeRush/Refactor Tools for SharePoint Devs
Although you need to purchase CodeRush/Refactor first, but if it will save me time, and make MOSS 2007 Custom Development easier, then it's worth considering purchasing the awesome tools.
Save Time => Increase Productivity => Get More Work Done => =o)
Sezai is Presenting at the August Perth SharePoint User Group Meeting
Details are here : http://www.connectedsystems.com/news/Event%20Library/Perth_SharePoint_User_Group_Meeting_August_2007.aspx
Event Information | ||
Event: Topic: | Perth SharePoint User Group Web Content Management in Office SharePoint 2007 |
|
Date and Time: | Tuesday, 21st August 2007 5:00 pm (3rd Tuesday of every month) | |
Presenter: | Sezai Kömür | |
Duration: | 1 hour | |
Description: | MOSS 2007 is a powerful platform which can be used to provide a wide range of solutions. One of which is to use MOSS 2007 as a CMS to power a public Internet website. Microsoft has discontinued it’s previous CMS product, MCMS 2002 (Microsoft Content Management Server) and specifies MOSS 2007 as the upgrade and migration path for existing MCMS websites. This session will provide an overview of the WCM features in MOSS, and what is required to develop a custom public Internet website solution powered on MOSS. The session will be led by Sezai Kömür, Senior Developer at Vivid Group. |
Sezai Passes Exam 070-542 - Microsoft Office SharePoint Server 2007 Application Development
YES I did it !
I just passed the MOSS 2007 development exam with a score of 959 / 1000 !
I completed the 3 hour exam in only half an hour.
For preparation I searched the internet and read other similar blog posts, then did what they did as far as getting test exams, and then studied the night before for about 5 hrs.
I might do one of the other WSS / MOSS exams to get MCTS SharePoint.... it would be nice to put into my email signature.
The Exam
Visit this http://www.microsoft.com/learning/exams/70-542.mspx it broadly describes what the test is about.
I think the exam is tough because MOSS is MASSIVE, and depending on your experience in developing solutions, you might only have worked with one slice of the MOSS Pie?(http://www.freshfromtheoven.co.nz/pages/home.aspx)
You might have only been involved in an Intranet project, or only a public internet wcm project etc. Depending on the specific MOSS solution, a single project would not make use of the entire pie.
Records Center, Information Management Policy, Excel Services and some InfoPath questions were tough because I haven't done as much custom dev in those areas, it was good to study for the exam because I now know more about MOSS as an entire development platform.
So the best advice I can give is focus on all of the Pie slices of MOSS especially the Pie slices with which you have had least experience working with. Mastering only one Pie slice won't be enough to pass. Eat the whole Pie, leave no slice untouched! Mmmmm Pie.
Still it was a tedious exam because a lot of the questions tested whether or not you know specific declaratives, methods and properties (meh what else would they test in a development exam?). Why, but why did I have to memorise the different nodes and structure of a BDC application definition? that wasn't fun at all.
When anyone is developing with Visual Studio .NET working on a MOSS development project in the real world, you have fast and easy access to information like this, you can easily look through the MOSS SDK or other documentation. With the advent of intelisense, classes that have methods/properties with comments, and due to the general size of the MOSS API, every developer wouldn't naturally try to wrote learn the entire class reference !
This leads me to believe exams are not a good way to test the ability of a developer, you can only learn this about someone by working with them for a while, the proof is in the work they produce.
Caterpillar Dealer WesTrac Launches THREE MOSS 2007 Public Internet Web Sites
Umbrella site for the world - http://www.westrac.com/
WesTrac Australia - http://www.westrac.com.au
WesTrac China -http://www.westrac.com.cn (In Simplified Chinese)
The cool stuff
Virtual Earth Location Finder
http://www.westrac.com.cn/locations
http://www.westrac.com.au/locations
Caterpillar Product Content
http://www.westrac.com.au/Products/Equipment
http://www.westrac.com.au/Products/Equipment/Off_Highway_Trucks
http://www.westrac.com.au/Products/Equipment/Off_Highway_Trucks/Pages/770_Off-Highway_Truck.aspx
Caterpillar Applications hosted in a page viewer web part
http://www.westrac.com.au/Online_Services/Pages/Parts_Store.aspx
Chinese English Language switching
http://www.westrac.com.cn on the home page and a few other pages where there is dual
Search
http://www.westrac.com.au/Search/Results.aspx?k=770
Random Backgrounds for home pages
The home page of each website loads with a random background image. The image is loaded randomly from a Picture Library, so if the background needs to change it's easy to add and remove new background images, very user friendly.
Use of Lists
Practically everything in the website runs off Lists. The Home Page Flash Movies, Links, Header Links, Footer Links and much more.
Lists are awesome because you get the nice List Management UI to add, edit List Items in a list, a lot easier than developing something similar from scratch.
As well as the usual functionality you get from a MOSS WCM Website.
These websites were also completed in record time, a lot less than any MOSS 2007 project I have been involved in so far. An excellent effort by the people at Vivid Group, and also the professional staff at WesTrac.
If you happen to be in Western Australia, New South Wales, Australian Capital Territory or China, then browse the Product catalog in the websites and contact WesTrac for some quality equipment !
MCMS (Microsoft Content Management Server) to MOSS 2007 (Microsoft Office Sharepoint Server 2007) Public Internet Website Migration
http://www.ggs.wa.edu.au/
Download my migration White Paper in which I detail the whole process -
http://vividgroup.com.au/docs/MCMS2002ToMOSS2007Migration-WhitePaper.pdf
Deploying Managed Properties and Crawled Properties for Search Between MOSS 2007 Servers
The next step involves manually creating Managed Properties and mapping them to Crawled Properties.
Working on our westernaustralia.com redevelopment project we need to create over 25 Managed Properties and map them to crawl properties, this is a time consuming (at least half an hour) task, an their is room for error, you could select wrong Data Types, map to the wrong properties etc.
I have repeated this manual process many many times, not the best use of anyones time.
There is an API provided in Microsoft.Office.Server.Search.Administration that allows you to automate creation of these.
Last week we had a visit from Angus Logan of Microsoft, after the visit he went back and whipped up a little console app demonstrating creation of Managed Properties and Mapping them to Crawled Properties.
Sahil Malik of winsmarts then picked it up and created an even better application that :
- Accept relevant inputs from the user- Export Managed Properties- Export Crawl Properties and relevant categories- Import Managed properties and map relevant crawl properties.
If you are working with creating Managed Properties and mapping them to Crawled Properties this will save you alot of time, and your sanity.
Check it out here
ORIGINALLY Published Thursday, November 16, 2006 3:50 PM
Securing MOSS 2007 Publishing Sites with Lockdown Mode
MOSS 2007 can also be used for collaboration, so users may need to view the list Forms, AllItems.aspx, DispForms.aspx etc. for a list so they can navigate through data in the site.
BUT You don't want people access to those forms if you are using MOSS 2007 for a public publishing internet site, you only want users to access Publishing Pages not to view all site content or to view lists.
So there is a feature you need to enable to keep anonymous users out of Form pages in your site, you also may want to restrict anonymous people from using remote interfaces which this feature also provides.
The feature is called ViewFormPagesLockDown, the details about this feature can be found on TechNet :
http://technet2.microsoft.com/Office/en-us/library/f507f5d6-4c9d-4f98-909f-069c53b9a3f61033.mspx#section6 - Use Lockdown Mode
The above page is handy and has alot of planning info for providing external anonymous access in MOSS 2007.
To Activate the Feature :
stsadm -o activatefeature -url
ONE IMPORTANT TIP :
I recently had this enabled on an anonymous site, but there was no effect, it was not working
It didn't seem to kick-in, I browsed the site anonymously and I could still get access to the Form pages, and view list data.
I didn't know what to do, finally the kind people at Microsoft suggested I try something to get it working.
What was the trick?
With the ViewFormPagesLockDown feature Enabled, I disabled Anonymous Access in the site, then re-enabled it.
After toggling anonymous access in the site, the feature started to work and anonymous users cannot access the Form pages anymore!
Setting up a Multilingual MOSS 2007 Farm - English and Chinese (Simplified) Websites Running on the same farm
I am working on a project to develop two websites for the same client, an English Language MOSS site and a Simplified Chinese MOSS site. The tough part is none of the developers on our team know Chinese, so this project will be an interesting one.
So you want to run different multilingual websites in the same Microsoft Office SharePoint Server 2007 farm?
Below are the steps I took to get this working, I can now create English as well as Chinese (Simplified) Websites in my MOSS farm.
Step One : Install operating system language
For Simplified Chinese I had to install the East Asian Language Files on the web front end servers via Control Panel --> Regional and Language Options then click the Languages tab and in the Supplemental Language section tick the Install files for East Asian Lanuages checkbox.
You then get a messagebox that tells you installing these files will take 230mb, after which you need to specify the locations of your Windows Server 2003 disk that contains the East Asian Language Installation Files. Once this has finished installing, you can start the MOSS install.
Step Two : Install MOSS 2007
Install MOSS 2007 as you usually would, and run the configuration wizard.
Once the configuration wizard has completed, STOP don't configure anything in central administration yet, you will be running the configuration wizard again shortly, after installing your sharepoint language packs.
Step Three : Download Your Specific SharePoint Server 2007 Language Pack, and burn it to disk or extract the files out
Navigate to http://www.microsoft.com/downloads/details.aspx?FamilyID=2447426b-8689-4768-bff0-cbb511599a45 and select your language.
It's a little tricky, because the page language switches to Chinese when you want to download the Chinese Language Pack, so I needed to guess what I should click in order to start downloading it.
Click the change button and then click the download button to download your specific language pack.
This downloads as a file called ServerLanguagePack.img and in my case the Simplified Chinese Language Pack was 195mb in size.
It's annoying this is an .img !
I did not want to burn to disk so I looked for image mounting software online, I downloaded the free DAEMON Tools 4.09.
Step Four : Install the language pack.
Go ahead and run the Language Pack on every front end web server.
It will pop-up the following :
TIP:
If you can't read the specific language you are viewing in sharepoint, a general rule of thumb is that links, checkboxes etc. and other UI controls are usually positioned in the same locations as the English MOSS, so I am able to navigate to Site Settings etc. on the Chinese site, even though I can't read a word of it, or instead remember the URLs to all admin pages and type the - '/_layouts/whatever.aspx' manually.
Step Five : Re-Run the SharePoint Configuration Wizard, Again
Now go back and run the SharePoint Configuration Wizard again,
Once this is complete it is a good idea to check the TEMPLATE folder in the server "12 Hive"
In my case I have a new folder below TEMPLATE called 2052, You should already have a 1033 folder for English.
If you try and open the files within folders of the 2052 directory they contain Chinese content.
So this process has created Chinese Site Definitions in your "12 Hive" in your web server's file system.
Step Six : Create New Websites and Site Collections
If everything is successful you should now have an extra option when creating a Top Level Site Collection.
You will notice something new, there is now a drop-down list box that lets you select the language for your new site !
If you select Chinese, then your new MOSS site will be fully chinese, all menus, site settings, InfoPath 2007 approval workflow forms everything.
Programmatically Accessing BDC Data in Custom Web Parts or User Controls in MOSS 2007
I want to programatically access data in a SQL 2000 Database using the BDC!
So I checked out the MOSS 2007 SDK and followed this example http://msdn2.microsoft.com/en-us/library/ms560143.aspx
following the example I will populate a DataTable with 2 string DataColumns, Town and the Region the town falls within. I have already created the BDC Application Definition to return the Town data from the external system. The following classes (and their properties or methods) will be used to retrieve this data and get it into my DataTable.
ApplicationRegistry
GetLobSystemInstances()
NamedLobSystemInstanceDictionary
LobSystemInstance
GetEntities()
Entity
GetFinderFilters()
FindFiltered ( FilterCollection, LobSystemInstance )
FilterCollection
IEntityInstanceEnumerator
MoveNext()
Current
NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();LobSystemInstance warehouseInstance = sysInstances["WarehouseListDataInstance"];Entity town = WarehouseListDataInstance.GetEntities()"Town"];FilterCollection fc = town.GetFinderFilters();IEntityInstanceEnumerator townEntityInstanceEnumerator = town.FindFiltered(fc, warehouseInstance);while (townEntityInstanceEnumerator.MoveNext()) { DataRow row = dt.NewRow();
IEntityInstance IE = townEntityInstanceEnumerator.Current;
row["Town"] = IE["Town"].ToString();
row["Region"] = IE["Region"].ToString();
dt.Rows.Add(row); }
Now I have access to the data I need to use in my User Control.
BUT... I could have also got that data by :
1. Hard coding it somewhere, saves time but then you have 2 lists and 2 places to keep data synchronised, depends on the data. (this is may also get you busted and some may shower you with curses)
2. ADO.NET it still works and I can still use it in my user control, it may actually be faster to use ADO.NET (hehe). You can still use the classes you all love and have been using for years instead of learning something new. (hey, it takes TIME to learn new stuff!)
In comparison to using ADO.NET,
All the backend system connection strings and actual method used to access the backend external data is all within that XML file, the BDC Application Definition file you either hand crafted or used some tool to create.
This provides a programming experience where you access that data through MOSS 2007.
Check out the MOSS 2007 SDK for more http://msdn2.microsoft.com/en-us/library/ms549009.aspx
MOSS 2007 Custom Search
A small suggestion : Try your best to use the Out of the Box Search, you will save alot of time, and it is very powerful and comes with alot of goodies.
I have previously used SharePoint Portal Server 2003 Search Web Service to provide website search functionality in a CMS 2002 web application. Search gets complicated when you need to integrate searching across different content sources, there was a CMS / SharePoint connector that allowed you to register Meta properties on CMS pages, sourced from an external system (a database containing Tourism data, rendered in web pages), you then use SharePoint to crawl your CMS site and the Meta propeties are also indexed and you can then use them to provide more advanced search capabilities.
Microsoft Office SharePoint Server 2007 makes that whole process alot easier, using the BDC. If you want to provide search across different systems, then MOSS can be used to index that data, so you can search it.
1. Create the BDC Application Definition file, and import it into your SSP.
In order for Search to 'Crawl' your BDC application, the application definition must contain a ProductIDEnumerator method. This method is used by search to return ALL the Identifiers (primary key, unique record identifier) for all records in the backend system. SharePoint then loops through all the IDs and returns a detailed record for each ID. Each record is then indexed and can then be used in search.
On importing your application definition, profile pages are created for your BDC Entities, browse to these pages and see if you can get data to display, if it does, then crawling the data in your external system may work.
2. Create a Business Data Content Source in Search Settings
Use your Shared Services Provider. Your SharePoint farm must have an SSP for search to work. When creating the Business Data Content Source, select your BDC application as the source. Then run a full crawl.
3. Populate Search using the Content Source
At this stage the items in the search index will increment to the total number of items that can be read from your external system. If that is not happening, you may be getting errors in the crawl process, fix them. (easier said than done, this can be a painful, time wasting process).
On the first crawl of your BDC application in search, the various fields you have defined will be detected as crawled properties.
4. Create the Managed Properties and Map them to Crawled Propeties
"... Mapping Crawled Properties to Managed Properties
To make a crawled property available for the Search experience, you must map it to a managed property. Mapping the crawled properties to managed properties makes them available for Search queries and makes them appear in Advanced Search and search results. You can map multiple crawled properties to a single managed property or map a single crawled property to multiple managed properties. If a managed property has multiple crawled properties mapped to it, and a document contains values for more than one of the crawled properties, the order in which the properties are mapped and their priority determine the managed property’s value... "
In search settings, click on Meta Property Mappings then, on the left hand menu you can switch between viewing managed properties and crawled properties.
So go through and create Managed Properties, and associate them to crawled properties detected when crawling your BDC. What's cool is that DataTypes are recgonised ! So if you define an integer or boolean or datetime as an attribute of a BDC entity, you create a managed property of that type. A cool feature is the ability to map more than one crawled property to a managed property.
5. Re-Crawl
You need to re-crawl your BDC content source now, as after associating the crawled properties to managed properties, a fresh crawl is required to populate them in the search index. If you don't re-crawl their won't be any items in the properties, and if the properies are used in search queries, it won't work.
When you view individual managed properites, the number of items in the search index which use them is listed on the page, so after crawling, check your newly created property and it should be populated.
6. Search has indexed the data, time for some programming
Get the MOSS 2007 SDK, or browse to Creating Custom Enterprise Search Applications for the online version.
The SDK states the three different Search Query types that can be used.
Enterprise Search in Microsoft Office SharePoint Server 2007 supports three types of search syntax for building search queries:
Keyword Query syntax (search terms are passed directly to the Enterprise Search service)
SQL syntax (extension of SQL syntax for querying databases)
URL syntax (search parameters are encoded in URL, and posted directly to the search page)
I have decided to go with the second option (SQL Syntax) the Enterprise Search SQL Query Language is a SQL style language used to build search queries. I say SQL style, coz it aint regular SQL! Also, I have used SharePoint 2003 SPS Query Language, and I found this to be fairly similar.
What is cool about building SQL Syntax search queries is you can use those Managed Properties mapped to crawled BDC properties, so that you can create an "Advanced Search".
I have done this, and for example, created a search User Control on "Accommodation" data.
In my custom search you can search for accommodation in Western Australia, and specify :
Type : Hotel, Motel, Resort, Cabin etc.
Price Range : $100 - $200
Disabled Access
Are Pets Allowed
Are Children Catered For
In a particular town : Perth
In a particular region : Australia's South West
With facilities : Bar, Fridge, Air Conditioning, Internet acess etc
We also needed Search across Event data, this required alternate criteria to be specified.
The Type of Event
Specify a Start Date Range for Events
Specify an End Date Range for Events
etc.
or for Tours, users need to search for
Towns Tour Visits
etc.
So I built a User Control which allows a user to specify combinations of the above criteria. The dude I sit next to at work was working on an awesome Suggest style ASP.NET User Control, it looks cool, I needed to use that control, and I was able to, by placing it in my User Control. I then placed that control in a MOSS 2007 Page Layout.
After the search is triggered and rendered users can then :
Page through results
Change Results Per Page
Re-Sort again based on Title, Price, Location etc. or by Date for Events
Click another link to filter results to a specific category
How did I provide all that filtering, and ordering functionality ?
By using the Search Managed Properties, which were mapped to BDC Crawled Properties in my Enterprise Search SQL Query.
The WHERE and ORDER BY clauses work similar to SQL, you can filter and order your results using data from the Meta Property Mappings.
For example, a the following query includes Managed Properties which are mapped to BDC properties, The query uses those BDC properties to both restrict the search to a particular category and domestic region, and also uses another BDC property to order the results first by the products' membership level, then by Rank (Pay us more $ and we'll rank you higher?)
SELECT Title, Path, Description, HitHighlightedSummary, Rank, ProductMembershipRank, DomesticRegion, ProductCategory
FROM SCOPE()
WHERE FREETEXT(Description,'Fun') AND ProductCategory = 'Accommodation'
AND DomesticRegion = 'Australia''s South West'
ORDER BY MembershipRank DESC, RANK DESC
The code needed in your custom web part or user control to execute the search query is :
FullTextSqlQuery ftsq = new FullTextSqlQuery(ServerContext.Current);
ftsq.ResultTypes = ResultType.RelevantResults;ftsq.QueryText =
//Return the search results to a ResultTableCollection
ResultTableCollection results = ftsq.Execute()
You can get a DataSet of results from the ResultTableCollection of search results. Then render this DataSet or get the XML representation and render that.
There are also other useful data you can get from ResultTableCollection such as ElapsedTime so you can also get the time taken to execute the search and render that to the user. The HitHighlightedSummary is very cool, it returns fragments of the content in a search result, and the term searched for can be highlighted so you can render search results that look cool, like a real search engine.
I created a "wrapper" class around search. it has an execute method, and alot of properties which you assign filter values to. My Execute method calls other private methods which build the Search SQL Query based on the properties set on the object and then use the FullTextSqlQuery class. but it also has Query properties, such as SelectProperties, WhereClause, OrderByClause which are created in the process.
So I can "chop up" and build search queries from existing ones, and do other cool OO stuff. it takes some time to code (any fans of dynamic sql generation code out there?) a wrapper class, but some investment like that is worth it, and allows other developers you work with to use Search to get data a little easier, without having to mess with queries if they don't want to.
One very cool feature you can provide in search, if your backend system entities have specified a URL path to a thumbnail image, you can use that to render image thumbnails in search results, looks very cool. That was actually a requirement for rendering which I had to provide, and could not using the OOTB search, also the requirements were very picky on searching across specific columns of data and not others, as well as specific weightings for columns, by generating queries myself I have full control.
It all depends on your data and requirements
So should you go Out-Of-The-Box or Do It Yourself for search?
Depends on whether or not you need to provide many advanced search filters and have very specific requirments on the rendering of the search results. You also have the control of building the queries and getting the data back from search and doing what you want with it. If your backend system requires very advanced specifc fine control searching, then build your own search queries and take more control over the search process. DIY also lets you use AJAX style search controls, and do pretty much anything else you want to because you have full control over the rendering of the Search Criteria UI and the Search Results.
My blog has moved....
to here ---------> http://sharepoint-sezai-moss-2007.blogspot.com