Skip to main content

Sharing is Caring

Go Search

Announcing: Community Kit for SharePoint: Development Tools Edition (CKS:DEV)
Happy Holidays!
Quick Deploy in SPVSX: Part One - Background and Approach
Announcing: SPVSX – SharePoint 2010 Visual Studio Extensions
The DebugApp trick for Productive SharePoint Development: Part 1
'Ello Guvners!
Speaking at Christchurch SharePoint User Group, this Tuesday!
Blog Hiatus, OE, and The Meaning Of Life
I'm A SharePoint Server MVP
Happy Christmas and a Merry New Year
Sharing is Caring > Categories
How-To: Search in 12 Hive Files using Visual Studio

Well folks, we're almost there, and not only that, we've reached a half century! This is blog 50 of one-blog-per-day-until-Christmas, and I aim to be consistent, so it's as incredibly obvious as the rest of them.

Now I'm sure you all know how to do this... but I wasn't aware of this functionality until recently even though there's a large button that indicates its existence.

First... I should explain what I'm trying to do: the essential task is to search within files in the 12 Hive. This is a common SharePoint development task, in response to questions such as "where is the feature with GUID x defined", or "what features are stapled to site definition Y"?

Here's some of the ways you might achieve this:

  • Download an application that searches inside files.
  • Use the (unreliable) built-in windows "search in files" option.
  • Install a desktop search utility that indexes and then rapidly returns results within files.
  • Use a command line grep tool or similar.
  • Manually open and scan every single file until you find what you're looking for (yeah, right!)

I've previously used a Windows app "Windows Grep" to do this, and its pretty fully featured. However, the "obvious" method I was missing previously is a lot more accessible for us devs, and my new search method of choice. Here it is:

  1. Open Visual Studio
  2. Hit Ctrl-Shift-F, or choose Edit -> Find And Replace -> Find In Files
  3. Hit the "..." button next to "Look In":

  4. Browse to the 12 hive in the "Available Folders" section of the resulting dialog, then click ">":

  5. Give your folder set a name such as "12 Hive", and click "OK"
  6. Search away as normal:

The cool thing about this is that the Folder Set now stays in your "Look In" list forever.

Yours in obviousness,

:) Matt

Development Toolbox: Guids in the Cloud
Since cloud computing is the new black, It's only fair that for this development toolbox post I feature a tool that's up in the cloud.  (If you're lost already, then don't worry, it's just a stinking website).
By the way, if you're counting then this is blog #24 of 1BPDUC, (aka post #3 of the cheating sub-series).
The Problem, Common Scenario, Or "Why You Need This"
When developing SharePoint features we need loadsa GUIDs.  Sometimes tools will generate them for us, but often we need to create them ourselves. 
Most people use guidgen.exe, or an IDE command.  However, sometimes you can't be bothered finding guidgen when it's not in the Path, or the IDE command doesn't appear which seems to happen to me a lot.
Enter The Tool
Here it is -!  Nice and easy.  And you can use this when out on the road, or perhaps when you're at the pub with a netbook and want to impress the ladies.  Smooth.
Tips For Usage
Err... click the large button that says "Create new GUID".
:) Matt
Development Toolbox: Unit Testing SharePoint Awesomeness
Typemock are offering their new product for unit testing SharePoint called Isolator For SharePoint, for a special introduction price. it is the only tool that allows you to unit test SharePoint without a SharePoint server. To learn more click here.

The first 50 bloggers who blog this text in their blog and tell us about it, will get a Full Isolator license, Free. for rules and info click here.

:) Matt

PS This counts!  Blog #22 of one-blog-per-day-until-Christmas!

Development Toolbox: Yet Another CAML Query Tool

Monday. Blog 14 of one-blog-per-day-before-Christmas. Tool time.

Today, we have yet another CAML query tool, named quite affectionately as "Yet Another CAML Query Tool (YACAMLQT)"!

The Problem, Common Scenario, or "Why You Need This"

You might think that YACAMLQT would be a tool for generating CAML queries, but that's not really it's purpose.

The main scenario of use is where you've already generated some CAML - perhaps using one of the other CAML query tools out there. And you want to then work with that as a nicely encoded string inside your code - perhaps to pass it into an SPQuery.

Enter The Tool

YACMQL, available from this blog post (jump to the bottom), is a simple windows client that allows you to convert a CAML string into a nice StringBuilder for use in code. Seems simple, but for a long CAML string this can be a real pain.

Simply copy and paste (or type) into the "CAML" tab:

Then hit the "C#" tab to get a nice StringBuilder all correctly encoded:

The tool will also convert to and from a SQL-like syntax that I haven't found a practical use for, and also to CAML.NET which is a specialist framework for generating strongly-typed CAML, worth a look if this sort of thing spins your wheels.

Tips For Usage

Just one: make sure to clear out the "Query" text before copying and pasting into the "CAML" tab, otherwise when you hit "C#" the original query text will be used to generate the StringBuilder.


:) Matt

TechEd 2008 - OFC303 - Deck and Resources

Hey Everyone,

Sorry for the delay in posting my TechEd deck and links up - I've been sick the last few days.

Matt (Left) and Zac (Right) presenting @ TechEd!

First - the downloads:

Next - here's some links and other info relevant to the content we showed in each of the 8 "rehab" steps (also click here to read Zac's content post).

Hope you've all managed to cure your SharePoint addictions since getting back home!

1. Optimize your development environment

Aside from the hardware optimization and tuning tips, Zac also demoed a few shortcuts. Here's some of the more useful ones:

2. Get a productive build cycle

In this I demoed both Visual Studio Extensions for WSS and STSDEV, and also mentioned WSPBuilder and Andrew Connell's Project Utility Window. Custom build scripts were also shown in the deck but not demoed - the code ZIP includes the OFC303.HelloWebPartCustomScripts project that was used to generate the screenshots in the deck.

Note that if using STSDEV with IIS7, you'll need to customise the Microsoft.SharePoint.Targets file for configurations that reset the app pool - see the STSDEV project in the code ZIP for a version of this. Also, the default configurations output by STSDEV do not support debugging, so to enable this (for each configuration you want to debug in) you need to:

  1. Access project properties (right-click project name, "Properties") and click the "Build" tab
  2. Click "Define DEBUG constant" and "Define TRACE constant"
  3. Click "Advanced"
  4. Change "Debug Info" to "full"

The last part of the demo in this section concerned the F5 DebugApp. In time I'll post a more detailed article describing the whys and hows of this approach, but in short here's how you do it:

  1. Create a web application project in Visual Studio (File -> New -> Project -> ASP.Net Web Application, not File -> New -> Web Site).
  2. Move the .csproj and .csproj.user files, along with the Properties folder, into C:\inetpub\wwwroot\wss\virtualdirectories\<x>, where <x> is the name or number of the web application corresponding to the SharePoint site you'd like to debug on.
  3. Attach the project to an existing solution (e.g. STSDEV project).
  4. Set as startup project (right-click project name, "Set as Startup Project").
  5. Access project properties (right-click project name, "Properties") and click the "Web" tab.
  6. Under the "Servers" setting, click "Use IIS web server", then enter the URL to the SharePoint web application you want to debug on, e.g. http://mymachine:99.

Kapow! F5 debugging against SharePoint.

3. Don't be a tool, be a better developer through tools!

Links to the tools we showed (in order):

More tool links can be found in the deck itself, particularly the "What's in our toolkit (partial)" slide, which Zac has also replicated in his post.

4. Only code when you have to

Links from Zac's post: Community Kit for SharePoint, Search Community Toolkit, Pod Casting Toolkit, Fantastic 40 Templates, Telerik Controls, Bamboo Solutions

5. Use the right tool for the job

In the first slide of this section, I mentioned a method for extracting list definitions from lists already set in the browser. Here's some tools/links that can help with this:

  • Andrew Connell's STSADM extensions - useful for extracting site column and content type XML.
  • Imtech STSADM extensions - effectively does the same thing as the SharePoint Solution Generator (part of the SDK), but without the GUI.
  • Also see Step 5 in Ari's post on creating custom list definitions. Once you've extracted the schema (using Imtech or the Solution Generator), you'll want to follow this step to hook up the Content Type used by the list to the site-level Content Type rather than the copy of the Content Type that the list gets.

In time, I will also post a script for extracting a list def with content types and site columns correctly hooked up in one go - it's not quite "community ready".

In terms of the User Control demo shown in this section, the code ZIP includes both the OFC303.UserControlWebPart and DebugApp projects, though without the SQL albums database (that was used to generate the ListView) this code won't deploy. However, the AjaxWebPart.cs that I inherited from (to get Ajax working) may be useful to some, as might the relatively simple UserControlWebPart.cs. Also in the code ZIP is an AjaxEnabler project I wrote to automate all the custom Web.config tweaks that get AJAX working. This is similar to "Ajax.Config" as available on the CodePlex Features project, but that wasn't around at the time.

6. Get friendly with Powershell

Zac showed a couple of quick demos of Powershell use in SharePoint. Here's a guide to get you started (from Zac's post). I'll try to post my own views on this in upcoming weeks.

7. Make peace with SharePoint Designer... it's for developers, too!

In terms of the features that were demoed, I showed:

  1. Creating a Linked Data Source combining SQL and SharePoint data
  2. Multiple item grid views and alternative layouts
  3. A joined sub-view that linked the SQL data with SharePoint data based on a "foreign key"
  4. No-code conditional formatting
  5. No-code two-way data binding with a single item form
  6. Web part connections between the grid view and form
  7. A completely custom XSLT rendering that generated a Silverlight chart from a data source

The code ZIP excludes the "code" for this demo (other than the Visifire XSLT), as without the database and specific SharePoint data this is relatively useless. However, here's a few links that may be helpful:

8. Get help faster, and stay up to date

Here are the links from the deck:

I also have a list of Essential SharePoint Resources up on my blog.

If nothing else, I recommend you subscribe to the aggregate blogs above. The best information usually has a way of getting through on these blogs.

Ask the Experts!?

Thanks again to everyone who attended, and for all the positive and constructive feedback. Until next time!

:) Matt

C-SPUG: 7 tips for Productive SharePoint Development

Tonight I co-presented at the Christchurch SharePoint User Group "lightning talks" sessions.  The idea here (which I stole loosely from Kirk Jackson and the Wellington .NET Group) was to have a number of speakers present short, sharp topics intended to give a broad overview for attendees in several different subject areas.  I think this was an interesting and fun concept, though it's hard to keep a presentation to 15 minutes when SharePoint is involved!

The slides from my 15 minute session on productive SharePoint development can be found here.  As a good introduction back into the world of blogging, I'm going to prepare a 7-part blog over the next couple of weeks that replicates and expands on the content from the 7 tips in the presentation.

Also check out Gary and Peter's blogs - I am sure they will post their resources in time.

If you were at tonight's session and have any additional tips of your own, or perhaps disagree with some of mine, I'd love to hear from you!

As an aside, I apologise profusely for my incredibly poor jokes in this and other presentations.  Despite this I am absolutely 100% confident that I'll continue to make bad jokes in the future.

:) Matt