# Wednesday, 21 April 2010

One of my pet peeves is software that thinks it's smarter than me. There are times when software does things I wouldn't think of, without asking me, and I find that helpful and I like it. But it can backfire. The worst offender was FrontPage, thankfully now gone. But Outlook has an annoying little habit. It assumes that people who send emails can't really be trusted to format them, so it "fixes" their error for you. In other words, if I send you this plain text email:

How are you doing?
Call me when you can.

Outlook helpfully displays:

Hi, How are you doing? Call me when you can. Kate

Most of the time that's only a petty annoyance. But what about when my code sends:

Monday 1:00
Tuesday 2:30
Wednesday 4:00
Thursday 9:30
Friday 10:00

And you see:

Monday 1:00 Tuesday 2:30 Wednesday 4:00 Thursday 9:30 Friday 10:00

Know what happens then? I do! The user reports a bug that the emails are misformatted. And what's more, when you tell them it's an Outlook issue and send them a screen shot of what to click in Outlook to fix it, they don't thank you. Well, Scott Mitchell has discovered what to do in your code to make Outlook leave your ratsen-fratsen line breaks alone. Just add a space before each newline. Awesome, thanks Scott!


Wednesday, 21 April 2010 08:49:00 (Eastern Daylight Time, UTC-04:00)  #    Comments [2]
# Sunday, 02 August 2009
I hate SharePoint sometimes. It's powerful, and strong, and free(ish) and does an amazing job. If you just want to install it and use it, there's really nothing to complain about. But it's greatest strength, and my greatest user-upper of swearwords, is that you can program against it. With each release, whatever I swore about last time is magically fixed (RunWithElevatedPrivileges FTW) but a whole pile of new misery sneaks in out of nowhere. (Well, and CAML remains, but I guess we can't do anything about that.) It's usually related to security, but not always, and the thing is that debugging it is always like surgery with oven mitts on.

I had a situation where I wanted to find the item you just added. Took a little searching, but I found it:

query.Query = "<Where><Eq><FieldRef Name='" & list.Fields.Item("Created By").InternalName & _
                "'/><Value Type='User'>" & SPContext.Current.Web.CurrentUser.Name & "</Value></Eq></Where>" & _
            "<OrderBy><FieldRef Name='Created' Ascending='FALSE' /></OrderBy>"
items = list.GetItems(query)
The first entry in items is the thing you most recently added. OK, fine. But we have event receivers on these lists, and they go off asynchronously. That means that right after you saved an item, while the receiver is still processing, the item isn't returned by the query.

Well that made me grumpy but I understood, so I made a loop, and if the first entry in items wasn't recent enough (say, in the last two minutes) I would have a little sleep and then ask again. But no matter how long I waited (even 20 minutes!) this code never would find the item. Oh, there was swearing, you can be sure of that.

I decided that SharePoint must be caching the query results. But searching for things like "SPListItemCollection cache" just got me helpful tips on caching these results myself, some thread safety issues, and the like. For example, this MSDN article says

You might try to increase performance and memory usage by caching SPListItemCollection objects that are returned from queries. In general, this is a good practice; however, the SPListItemCollection object contains an embedded SPWeb object that is not thread safe and should not be cached.

Does that match up well with what I am seeing - always the identical results from this query-in-a-loop even though I know the underlying list has changed while the loop was running? It does not.

Then I found two blog entries by Jeff Crossett: first the complaint, and then the solution. He's right. And when I implemented his hack:

' use a random value in query so we don't get cached.
randomValue = generator.Next(100, 1000000000)
query.Query = "<Where><And><Eq><FieldRef Name='" & list.Fields.Item("Created By").InternalName & _
                "'/><Value Type='User'>" & SPContext.Current.Web.CurrentUser.Name & "</Value></Eq><Neq>" & _
                "<FieldRef Name='Title' /><Value Type='Text'>" & randomValue.ToString & "</Value>" & _
                "</Neq></And></Where>" & _
            "<OrderBy><FieldRef Name='Created' Ascending='FALSE' /></OrderBy>"
items = list.GetItems(query)

We all lived happily ever after. Well, until the next WTF that SharePoint throws my way. I am doing amazing things with this product. My customers would pay more for their software if SharePoint didn't exist. But man, sometimes it is HARD.


Sunday, 02 August 2009 08:26:35 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Friday, 26 May 2006

Our free "what is SharePoint" seminar went off without a hitch on a grey cool Peterborough afternoon. The recurring theme from attendees, as well as some contacts I invited who couldn't make it, was "is it really free? How can that be?" Windows SharePoint Services really is free with Windows Server 2003. Here's a quote from the Microsoft site:

Now shipping as part of Windows Server 2003 R2 or available for download at no additional charge, Microsoft Windows SharePoint Services technology in Windows Server 2003 is an integrated portfolio of collaboration and communication services designed to connect people, information, processes, and systems both within and beyond the organizational firewall.

It really is free. Tell your friends!

We got a few inquiries from folks who lived a little too far away to attend and they asked about a webcast or another location. Please leave a comment if you or someone you know would like to attend one of these, either real or virtual. We just spent an hour and a half putting WSS through its paces and showing what it does out of the box.


Friday, 26 May 2006 16:37:49 (Eastern Daylight Time, UTC-04:00)  #    Comments [1]
# Wednesday, 17 May 2006

At the end of next week, May 26th to be precise, we're going to give a free "What is SharePoint" seminar in Peterborough. We'll be focusing on what it can do "out of the box" and demonstrating how much functionality you get for free. So if you know someone who lives northeast of Toronto (or feels like a Friday afternoon headstart to the cottage) please do pass the details along. It's from 2:30 to 4:00, it doesn't cost anything but we would like you to register, and we'd love to see you (or your friend or client) there.

http://www.gregcons.com/seminar2006.htm for details.


ps: no C++, I promise :-)

Wednesday, 17 May 2006 22:54:17 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Tuesday, 16 May 2006

As you probably know, when you're looking at a document library in Sharepoint, each document name is a link to the document:

If you click the link, the document opens in Word. I do that a lot, or else I right-click the link and Save Target As to put a copy on my own machine. You probably also know that there's a menu hanging off that triangle, and you could edit the document using that menu:

What I didn't realize until today is that these two choices behave differently. Click the link and Word opens the document as Read Only, so that when you click the Save icon in Word or choose File, Save, you get the Save As dialog. You can save it back into the same Sharepoint directory you opened it from, but it's an extra step:

If you use the menu item, it's not read-only and if you save it just saves with no further conversation. Now normally I would NEVER drop down a menu and choose an item from it when I could click a link. But since it turns out there's a difference, I'm going with the menu from now on.


Tuesday, 16 May 2006 16:48:06 (Eastern Daylight Time, UTC-04:00)  #    Comments [1]
# Saturday, 06 May 2006

I have a mentoring client who is doing a fair bit of Sharepoint work. Some of it I just do for them and install on their servers, but I'm working closely with a team of developers who are building up their skills on both development and administration, and putting sites into production for real people to use to do their jobs.

This client is a pretty large firm - a Canadian household name - and so in addition to a large team of developers they have an infrastructure team, the "downstairs guys" who configure and support all their servers. As the number of Sharepoint sites grows, we're having strategy meetings with developers and infrastructure people about how to handle the growth of Sharepoint within the firm.

So at one point in this meeting the infrastructure person says to me "I need some sort of reports, some way to know how big a site is getting. I can look at the size of the SQL database but it's not very accurate. Or when we do the backups I can look at the size of the backup file. But then how can I tell what the issue is -- maybe someone has turned on versioning or something else that eats up disk space." Various people in the room start talking about the Sharepoint object model, about pointing SQL Reporting Services at a Sharepoint data source, and other developer approaches to the problem.

Now earlier in the meeting several of the developers had been telling the infrastructure person that he has to come to grips with Front Page. There are some things that are really hard to do any other way, and really easy to do with Front Page. And as a result I had Front Page open on my laptop and had opened a site (our own Gregcons internal site as a matter of fact) but hadn't done anything in it. So during this conversation about how to know the size of the site, I clicked the Reports button on the bottom Front Page toolbar that shows when you've opened a web:

And what do I see when I click that?

I grinned and spun the laptop around so that the infrastructure person (and his grandboss, who was at the meeting with us) could see it. "You're going to have to learn to love Front Page," I told him. And to the grandboss I said "aren't you glad you have a consultant?"

A lot of times I work really hard and long to bring my clients value. But there are so many times when I can do something in 30 seconds that the client would have spent days doing another way. I love those times.


Saturday, 06 May 2006 07:46:36 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Friday, 28 April 2006

Last night we had a community get together on the last day of VSLive. Billy Hollis, Steve Lasker, and Josh Holmes were there from out of town, and the Toronto .NET Glitterati (Rob Windsor, Graham Marko, Chris Dufour, Jean Luc David, Dave Totzke, Barry Gervin, Eli Robillard, and many others) as well. It seems that no-one had a camera along, so you'll have to take my word for it :-).

I got a chance to talk to Jerome Carron, who like me is speaking as part of the realDEVELOPMENT_06 tour in late May and early June. We will be seeing a lot of each other since we are also both going to be at DevTeach. If you haven't registered for either of these events, you really should.

I've been quiet lately because I've been preparing my slides for DevTeach and TechEd, and working on some material for a Vista Ascend that premieres in May. I also put a new Sharepoint site into production at a client -- and if you've ever had the delight of promoting a gaggle of web parts, aspx pages, and special versions of selected magical XML files all up to a production server from a staging server, then you know why I haven't had time to blog. But it works now, and the clients are all happy. Me? It's a good thing I know how to sleep on a plane.


Friday, 28 April 2006 15:12:30 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Thursday, 06 October 2005

At the PDC, we were shown what Office 12 is going to be like, and it was impressive. But since then more announcements keep coming out about it that in many ways are more impressive than the new user interface. (If you're thinking "what new user interface?" you need to check out the future Office page at MSDN for details.) Apparently the Channel 9 Video has been insanely popular also. In some ways the Open XML formats are more exciting than the UI , especially for developers. And now this: Office 12 - not just Word, but Excel, PowerPoint, Visio, everybody - will all know how to publish their documents as PDF. No third party tool, no add in, it will just work. I read about it on Brian Jones' blog, but there are also details on that future Office page.



Thursday, 06 October 2005 06:53:18 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Wednesday, 03 August 2005

Did you know that Visual C++ 6, which is fast approaching its seventh birthday, will soon be an unsupported product? That's not exactly shocking; after all it was developed to let developers target Windows 95 or NT! Perhaps you were wondering when some other applications you use are going to reach end of life.... in that case, here are some handy links:

If there's something you don't feel like upgrading, you might want to know how long it will be supported for as part of your wait-or-upgrade-now decision.


Wednesday, 03 August 2005 15:30:47 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Monday, 06 June 2005

One more entry on this very busy day: the VSTO team announced today that VSTO will be (has been, but it's still in beta) expanded to include support for creating Outlook add-ins with managed code. There's a 5-page description on MSDN already.

This is making a cool tool, VSTO, even cooler. If you haven't noticed VSTO yet, it's time that you did. My Office 2003 category is pretty much all VSTO posts, versions 2003 and 2005.


Monday, 06 June 2005 17:51:09 (Eastern Daylight Time, UTC-04:00)  #    Comments [1]
# Tuesday, 17 May 2005

With the seven-city Smart Client Deep Dive tour done, I thought it would be appropriate to summarize my upcoming speaking and training schedule.

  • May 23-26. Ascend Training (Smart Client Track) Redmond, WA. Teaching Microsoft people and special guests (MVPs, RDs, partners) all about Smart Clients (VSTO, WinForms, and more) in Whidbey.
  • June 3. Ascend Training (one day ultra condensed) Orlando, FL. This is a pre-conference event for Academic Days at Tech Ed.
  • June 6-10. Tech Ed USA,  Orlando FL. Two talks (Monday morning and Tuesday morning - both are C++ talks and who would go to only one of them? See the new syntax, new optimizations, new power for an old friend - search for DEV330 and DEV331), one panel lunch (women in technology), and helping out with the way cool thing the RDs are doing that I can't quite discuss yet.
  • June 18-19. DevTeach, Montreal Quebec. A Canadian User Group Leader get-together, and my two C++ talks glued into one “What's New in C++“ presentation.
  • October 23-26, Tech Ed Africa, Sun City South Africa. OK, I'm not officially accepted as a speaker yet but I'm pretty sure I'll be there, topics TBD.
  • Nov 7-10. C++ Connections, Las Vegas, NV. How real customers are moving to the new C++.

This is just the stuff I'm on stage for. I'm planning to be in the audience at either or both of the PDC and the MVP Summit, both in September.  And oh yeah, I have a company to run and some projects to finish. Gotta dash!


Tuesday, 17 May 2005 10:39:50 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Monday, 28 March 2005

What does it take to become a SharePoint developer? You should understand how SharePoint looks to a user, and the best way to learn that is by using it. You should know where to find the documentation for the object model and for CAML, and that means lots of Googling because it's not all in MSDN by any means. And then of course you need to be a developer. Mike Fitzmaurice makes it pretty clear that means an all-around good .NET developer. He's inspired by Gregory MacBeth's inaugural blog post that lists the steps to becoming a good SharePoint developer. Gregory sets the bar pretty high - step 0 is get your MCSD, and then the real learning can begin. My attention was caught by Mike's postscript that in addition to being an all-round .NET dev, in VB or C# as you prefer, and learning the SharePoint-specific material, you're also going to need C++:

Attention tool builders and other interested developers — in the next release, protocol handler development and IFilter development will still need to be in C++.  Do not wait for the rules to change, because they won’t (at least not before “v4”).  If you want to extend our search technology to new content sources and formats, you might as well get started now.  Search gets a lot better in many ways, but the method for developing IFilters/protocol handlers isn’t one of them.

So, all round .NET dev, SharePoint object model, CAML etc, and while you're at it, C++. No wonder I'm finding good SharePoint devs rather hard to find!


Monday, 28 March 2005 15:25:37 (Eastern Standard Time, UTC-05:00)  #    Comments [2]
# Saturday, 19 March 2005

I'm going to be travelling across Canada in April and May to deliver the next round of Deep Dives -- these ones on Smart Client development with VSTO 2005. Here's the abstract:

Recommended Audience: Developer.

Microsoft Office has established itself as the standard for office productivity applications. Knowledge workers use the Office tools (word and excel) to create and mine data. The experience and familiarity with these tools can be leveraged to build a new breed of applications to make working with important information easier using Word and Excel as application interfaces.

This session will explore the details of creating Smart Client Applications using Microsoft Office System and Visual Studio Tools for Office. This session will include data access techniques for online and offline work, security considerations and leveraging the .NET Framework and web services to interact with Line of Business applications. This session will also provide attendees with prescriptive guidance on choices for application development, comparing all the possibilities for smart client development, in the form of a decision matrix.

Here's the schedule and some links to register:

Ottawa April 19
Waterloo April 20
Windsor April 21
Vancouver April 26
Calgary April 27
Halifax April 28
Toronto May 3
Montreal May 4

I am preparing the material right now, and it's all Visual Studio 2005 and VSTO 2005 -- if you've seen me do VSTO 2003 material before, you're going to be delighted with the new tool! It's much more designery and much less “now simply provide implementations for the following 20 functions with almost identical names.” That means there's time to show cooler stuff, and I fully intend to. See you there!


Saturday, 19 March 2005 13:40:25 (Eastern Standard Time, UTC-05:00)  #    Comments [3]
# Friday, 05 November 2004

Last night I spoke to Carl Franklin (my fellow RD) for Dot Net Rocks. Over the course of an hour and a quarter we talked about C++ (I think I'm converting him :) ) VSTO, VB, sockets, what I have for breakfast, Carl's Westminster Abbey experience, and assorted geeky things. It was a lot of fun. Here are some links stolen from the site:


Friday, 05 November 2004 09:53:38 (Eastern Standard Time, UTC-05:00)  #    Comments [0]
# Tuesday, 02 November 2004


I'm going to kick off the Smart Client User Group Tour with a talk in Winnipeg. I'm expecting a slight contrast between South Africa in late October and Winnipeg in early November :-). The talk is November 10th, details on the Winnipeg UG site.



Tuesday, 02 November 2004 16:23:13 (Eastern Standard Time, UTC-05:00)  #    Comments [1]
# Friday, 29 October 2004

 For November, the Toronto-area user groups are combining our meetings to participate in the MSDN User Group Tour.

Building Smart Client Application using Visual Studio Tools for Office Version 2003

This session provides an overview of how you can use the Visual Studio .NET 2003 project templates provided by Microsoft Visual Studio Tools for the Microsoft Office System to create Smart Client solutions that use Microsoft Office Excel 2003 and Microsoft Office Word 2003. This session will also show the value of InfoPath, how to build solutions and review many of the new features and managed code support. Microsoft Office InfoPath 2003 is a hybrid tool that combines the best of a traditional document editing experience, such as a word processor or e-mail application, with the rigorous data-capture capabilities of a forms package.

The speaker is Derek Hatchard, and the meeting is at 200 Bloor St East in downtown Toronto. For directions and to register, please visit http://www.metrotorontoug.com/User+Group+Events/116.aspx. This meeting is being held on the regular East of Toronto meeting date, November 16th. Doors open at 6 and presentation starts at 6:30. Please register in advance not only for the usual food reasons, but to simplify the job of the door security at this downtown building.

See you there!



Friday, 29 October 2004 15:23:30 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Tuesday, 26 October 2004

It's still gorgeous, sunny, and HOT here. I did two talks today -- the C++ and the VSTO ones. I was really pleased with the C++ attendance, and people saying “I'm going to switch back” after seeing what Visual C++ 2005 is going to be like. And that was with no demos! VSTO is a very fun product, and easy to demonstrate too. So two pleasant sessions with very nice audiences and great logistics.

One more day, one more talk, but first I think I'm going to go for a swim...


Tuesday, 26 October 2004 10:31:44 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Thursday, 14 October 2004

I'm on vacation at the moment (travel blog entries to come if I get any free time) but had to take a minute to mention that I'll be speaking at Tech Ed South Africa at the end of the month. I'm doing three talks: better performance in VB, programming with Word or Excel as your user interface with VSTO, and Visual C++ 2005 and the C++/CLI features -- which the organizers were nice enough to add just because I asked them to. I'm really looking forward to the trip and the people!

C++ | Office 2003 | RD | Speaking | Travel
Thursday, 14 October 2004 18:07:48 (Eastern Daylight Time, UTC-04:00)  #    Comments [1]
# Thursday, 20 May 2004

On Patrick Tisseghem's blog I spotted a link to a Sharepoint quiz. I was pleased to get 9 out of 10 (I lost one mark by underestimating Front Page, easily done.) There are other office quizzes you can take when you get to the site. Nice way to keep from working on a beautiful morning.


Thursday, 20 May 2004 08:06:27 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]