Two excellent resources for ramping up on SharePoint 2007 event receivers.
Two excellent resources for ramping up on SharePoint 2007 event receivers.
In IIS6 on Windows Server 2003, we could recyle the application pool that hosted our SharePoint site in order to force the web application to perform a JIT compile. This would then reload any DLLs it required. This saved a considerable amount of time over an IISRESET.
That command is:
C:\windows\system32\IISApp.vbs /a "SP Site App Pool" /r
(Note that the first time you run IISAPP.vbs, you’ll get a few confirmation prompts.)
This VBS script does not exist in IIS7 on Windows Server 2008, but the good news is there is an even better command:
c:\windows\system32\inetsrv\AppCmd Recycle AppPool "SP Site App Pool"
Type “AppCmd /?” for a list of all the useful actions you might want perform against your IIS7 installation.
Better late than never…
It’s about time I wrote about the experiences of what was the SharePoint Conference, 2009 edition, in Las Vegas. By now many others have had their recap, and with my own experiences being somewhat similar, I shall try to keep mine succint, but entertaining.
My first major Microsoft conference was the Office/SharePoint conference in Redmond (or was it Bellevue) in March 2005. I had just started with Habañero Consulting Group, had just gone through a nasty learning experience on a custom “workflow” type issues and tasks solutions on SharePoint 2003 (which was NOT fun for many reasons), and so was pretty wide-eyed and overwhelmed when I attended the sessions. Aside from the two co-workers I went with, I knew no one else, didn’t know any of the “big names”, and didn’t really have any sort of game-plan whatsoever. We heard a lot of ideas, I saw some code, saw some bad presentations, and concluded the conference with pretty much a “meh”. The most exciting part was the road trip from Vancouver in my car, and I’ll never forget the “thud” that my car had to endure as I drove it off a curb because my “navigator” (she will remain nameless, for now…) missed the exit, it was dark, and I was desperate to turn around and find the hotel.
SharePoint Conference 2008 came to Seattle in February, if i recall correctly. Due to the success the product had in 2007, it was going to be a big deal for SharePoint 2007, with which I’d been working since the summer of 2006 (Beta 2). Having spent two years prior on MCMS 2002, I was fortunate to be involved in a WCM solution in the summer of 2007. By then, I had learned a lot through discovery, but also through reading the content of others. I also attended the first running of Andrew Connell’s WCM401 online class. I had a bit of a game plan this time, but it mostly involved the sessions, attending them as strategically as I could, trying to learn things outside of my SharePoint comfort zone. I learned some new things, saw better presentations, but generally didn’t feel as out of place as I did in 2005. I attended SharePint, met a few people throughout the conference, but pretty much stayed with my co-workers and didn’t realize the social aspect of these conferences. Since the two MOSS exams were available for free, I decided to give them a shot and passed both. Cool. The stay at the W was also a nice luxury that Habanero generously provided.
Throughout 2007 and 2008, I was focussed primarily on SharePoint projects. I learned more and more with each one (as one should), became more confident, and looked forward to the next conference. Soon after it was announced, I bought an early-bird ticket. Throughout 2009, I grasped on to Twitter, started following a few SharePoint people, and once in a while would engage in some sort of “conversation” with people whom I’ve never met. It was very cool. Heading down to Las Vegas for SPC09 I decided I would try to meet as many people as I could, to personally thank them for the work they have put into the community over the last few years from whom I’ve benefitted directly as well. I decided to splurge a bit and stayed at THEhotel, attended SharePint at EyeCandy, and throughout the conference just shook hands and tried to track down a few people to say “hi” and “thanks”. I had never been to Vegas before, but it wasn’t until Tuesday evening (after the 80s party with Huey Lewis and the News) that I even stepped outside of the Mandalay Bay Center.
It was a great conference with a lot of content (overload), but what made it really special for me was the chance to meet many of the cool people in the SharePoint community of which I’m proud to be part of.
Well, like about 7000 other people from around the world, I’ll be at the SharePoint Conference in Las Vegas this coming week. I’m excited about it and looking forward to meeting many new people. I’ll also be looking to thank some great community contributors to whom I am very grateful and appreciative.
I’ll be leaving Vancouver mid-morning on Sunday, arriving by about 1:30 or so. Hope to see you there!
Finally selected a web host for my new domain, installed WordPress, upgraded it to 2.8.4, and installed a new theme (custom one under development).
Wasn’t so bad, quite nice and easy actually. Next up, moving my old blog postings over to here. Any posts with a date earlier than this one are posts the old blog (which explains why this “New Blog” post appears “in the middle”).
I have a custom publishing site definition. It was, of course, based off the default publishing site definition. I re-organized some features around, and added custom versions of required features just so I could control everything a little more to my liking. Anytime we do this, however, we run the risk of “what did I break?” syndrome.
One of my clients was using the Content Editor Web Part on one of her page layouts (instead of using a RichHtmlField – long story). She noted that she could not select the “Use Predefined Table Format” in the Table Editor web dialog. Hmmm… I didn’t do anything specific to disable that capability, so I needed to do some digging.
Since I was using a custom publishing site definition, I needed to determine if this behaviour was happening with the default Publishing Portal definition. Sure enough, adding a CEWP to the home page of the Publishing Portal yielded the same effect: I could not use the predefined table formats. I then check the Press Releases default page, which does have a RichHtmlField for me to play with. I can use the predefined formats here. I proceeded to add a CEWP to the zone at the bottom of the page, and here I can also use the predefined formats. Interesting…
I fired up my favourite search engine, and came across this posting from Microsoft: How to enable the “Use Predefined Table Format” setting when you use a Windows SharePoint Services template in SharePoint Server 2007. Cool! But note the location of the CSS: /_LAYOUTS/1033/STYLES/HtmlEditorTableFormats.css. In my case, I have the French language pack installed, which means I have to account for the 1036 LCID also.
I checked the master pages and page layouts that PublishingLayouts feature use, and note that there is not a reference to that CSS. Nor is it in the page layouts found in the PublishingResources feature. What gives? What’s the correct syntax?
No matter. I’ll just add a link to the CSS by building out the path to the right LCID folder, using something like System.Threading.Thread.CurrentThread.CurrentUICulture to get the LCID. After some frustrations (which I won’t get into here), I quickly realized that this would not work in my scenario (Canadian English is not 1033) either.
I looked at the source code for my out-of-the-box publishing portal (the Press Releases page). I noticed that core.css also comes from the LAYOUTS/1033/Styles folder. Some more digging, and I realized that I did not need to specify the full path, like this example taken from BlueBand.master:
<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css %>" runat="server"/>
but instead I needed simply this:
<SharePoint:CssRegistration name="HtmlEditorTableFormats.css" runat="server" />
and SharePoint takes care of the rest, building out the path to the appropriate Styles as required, like this:
<link rel="stylesheet" type="text/css" href="/_layouts/1033/styles/Htmleditortableformats.css?rev=guYGdUBUxQit03E2jhSdvA" />
Here is a great post which talks about what’s going on, and what renders HtmlEditorTableFormats links. It explains why I could not find it in any of the master pages or page layouts: the RichHtmlField web control inserts CSS links to HtmlEditorTableFormats.css and HtmlEditorCustomStyles.css OnLoad() . <groan! />
There is a more efficient way to do content type IDS than we have done in the past: http://msdn2.microsoft.com/en-us/library/aa543822.aspx
Say we wanted to inherit from “Page”, our content type used to look something this (I’ve split up the lines so it will display properly):
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF5
Meaning, inherit from “Page” (the red part), include a delimiter (00), and then append a GUID.
If we then wanted to extend this content type, we could do this:
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF500DFA39D91C06D48BDBC415E7CE80A95CD
And so on… You can imagine how hairy-scary the ContentTypeIDs can get if you wanted your inheritance to go a few levels deep.
As per the article, there is a more efficient way; the second ContentTypeID above could become:
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF501
Where the tail 01 is the extended content type. Thus, we could have:
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF501 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF502 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF503
etc.
And then to extend from either of these:
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF50101 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF50102 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 188024C0FF7F45CFB85EBB43980DACF50201
etc.
IMO, this makes the ContentTypeIDs much easier to work with (and read), and we run less risk of running into URL length issues within SharePoint.
PS. The GUIDs used in the above examples have been changed to protect the coder. Any resemblance to any existing ContentTypeIDs are purely coincidental.
Ok, the title is vague, but there’s only so much I can put in a title, right?
As per MSDN’s documentation for the Microsoft.SharePoint.WebPartPages class and Andrew’s post on v3 web parts, we should now inherit from System.Web.UI.WebControls.WebParts.WebPart when we are building custom web parts, except in the four scenarios he mentions (repeating here for my own records):
However, I came across a situation recently whereby a very simple custom web part (all it did was render a “Get Adobe Acrobat” link, essentially) threw a SharePoint error to the screen when used in conjunction with Variations. Here’s the steps to replicate:
System.Web.UI.WebControls.WebParts.WebPart. Keep it simple; “Hello World” is fine.It took me a while to figure out what was causing the problem. I finally had a thorough look in the SharePoint logs, and found the message that told me the cause. If you are using SpsDev’s ULS Log Reader, filter by Area:CMS, Category:Publishing, or just look for the message “Unable to cast”. The relevant part of the message is:
Unable to cast object of type '******.Website.SharePoint.WebParts.AdobeLinkWebPart' to type 'Microsoft.SharePoint.WebPartPages.WebPart'
Um, what? Why does it want to do that? So…
Microsoft.SharePoint.WebPartPages.WebPart.Microsoft’s own web parts that inherit from System.Web.UI.WebControls.WebParts.WebPart don’t seem to have the same behaviour. Nevertheless, I believe this to be a bug, but one that you should know about when using custom web parts in conjunction with Variations.
The PortalSiteMapProvider class is the base provider used by the four default “CMS” SiteMapProviders:
That is, all of these SiteMapProviders use the same base code to generate a data source, but their “output” differs slightly due to the different attributes that are applied.
Recently, we wanted to filter out the pages from showing up in our left-navigation. You can do this at the rendering stage, but since the PortalSiteMapProvder gives us an IncludePages property, we can simply create a new entry in web.config for our “custom” provider, like this:
<add name="CurrentNavNoPagesSiteMapProvider" description="CMS provider for Current navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="true" IncludePages="Never" />
By default, there is also a 50 returned-items limit; we can set the DynamicChildLimit to “0″ to override this.
<add name="CurrentNavNoLimitSiteMapProvider" description="CMS provider for Current navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="true" DynamicChildLimit="0" />
Of course, you can combine the different properties to come up with a combination you need. The next thing we would need to do is reference these new providers, and voila!
And if you haven’t read Chris Richard’s series of articles about MOSS Navigation and how to get better performance using the PortalSiteMapProvider, you really should…
Came across this while cruising around:
http://content.techrepublic.com.com/2346-10877_11-895-9.html
http://www.oldcomputers.net/vic20.html
5K (3.5K usable). wow. We also had the tape drive. Wicked. Ask me how we searched for programs on a tape…
And for the record, our *second* computer was an (original, not a clone) Apple IIe with dual disk(ette) drives. My buddy had an Apple IIc, and my future neighbour had an Apple Lisa.
(Ironic how I am posting about one of my old computers, the Apple IIe, which was codenamed “Diana”, on this, the 10th year of Diana’s death.)