Adding Snippets in Visual Studio

I keep forgetting how to do this, and have to do so every time I want to create a new SharePoint workflow.

  1. Open Visual Studio.
  2. Right click on toolbars and ‘Customize’
  3. Click ‘Commands’ Tab.
  4. Click on the ‘Tools’ category.
  5. Add the ‘Code Snippets Manager’.
  6. Add ‘C:Program FilesMicrosoft Visual Studio 8Xml1033SnippetsSharePoint Server Workflow’ to your snippets
  7. It should be straight forward from there…

Comments from my old blog:

Are you using your own project templates? I’m curious because using the MOSS Workflow Project templates (both state machine and sequential)–the templates that come with the MOSS SDK–and I have the snippets already available to me.

Anyway, just throwing that out there.

By Peter {faa780ce-0f0a-4c28-81d2-3 at 17:30:01 Monday 10th September 2007

Nope, these are the ones out of the SDK. I’m not clear why, but in some VMs that I use the snippets aren’t immediately available after I install it. And normally the ‘Code Snippets Manager’ is already available too – but not always. I haven’t figured out what factor causes these things to occur :/

But yes Peter, you’re right – normally they should be available.

By Andy B at 11:16:21 Tuesday 11th September 2007

Adding Snippets in Visual Studio

Excel Services – save a spreadsheet through the web interface…

There was me thinking that this wasn’t possible –You can save an Excel spreadsheet presented via Excel Services. Well, kind of. It’s prototype code, and unsupported, but still, that’s waaayyy cool. Now, all it needs is to work with check-in/check out or ‘last wins’.

Excel Services – save a spreadsheet through the web interface…

Create a custom Expiration action

Excellent work from Ton Stegeman – Adding a custom action to the MOSS expiration policy. Also, MOSS Custom policies parts One, Two and Three. I was particularly interested in Part 2, ‘cos it is programmatically submitting an item to the Records Repository (via a web service. I guess that’s okay, but I was surprised that this didn’t appear to be in the Object Model. Or maybe it is and I just can’t find it!)

Create a custom Expiration action

Creating Site Templates

Note that Site Templates aren’t the same as Site Definitions. Good article about how to do this here. Or read Creating a Custom SharePoint 2007 Portal Site Definition using the PortalProvisioningProvider Class for ‘portals’ (I agree – that’s the most over-used word in SharePoint, along with confuse over what a ‘site’ is (sometimes a collection, sometimes just a site…)).

It’s worth considering the differences between (more here). Some of the differences demystified (note – about Beta 2). Info on how to create a custom site definition (hint – copy an existing one – bit more here). And information on which existing templates are right for me.

Creating Site Templates

Extending VM discs – notes for myself

  1. Shutdown your VM.
  2. Make a copy of the latest state (or the one you want to extend the disc for). You can’t keep snapshots across extending the disc.
  3. Open command prompt, and go to “c:program filesvmwarevmware workstation”
  4. Run the command vmware-vdiskmanager -x 10GB -t 1 “path_to_VMDK_file” . This will extend the virtual hard disc at the path defined to be a 10GB disc, stored as growable 2GB files.
  5. Start the VM. Go to Disk Management, and you’ll see a bigger disk, now with a large unallocated space. You need to extend the partition into that space.
  6. If it isn’t installed already, install DiskPart (which can be downloaded from Microsoft). This is a Microsoft tool, and is built into Windows 2003 Server. However, it works on 2000 and XP too.
  7. Open a command line, and run DISKPART
  8. Type list volume
  9. From the list, identify the volume you want to extend (2 in my case)
  10. Type select volume 2, where 2 is your volume from 9) above.
  11. Type extend.
  12. Job done.

Based on some instructions from here, but I think mine are simpler…

Extending VM discs – notes for myself

The Pain of VB6

So, I’ve been forced to spend a couple of weeks modifying some code I wrote a couple of years back, in VB6. One word – crap. That’s the word for both the language, and my code.

Visual Basic 6 is just painful to code with. ‘Dim’? I’d say. The inability to return arrays from a function keeps catching me out. And I detest the way that no matter what I do, I can’t stop Visual Studio beeping errors at me and show message boxes when I try to leave an incomplete line so that I can copy and paste a variable name.

The worst part is, though, that it doesn’t really promote good program structure – well, not to me anyway. I’m often not entirely convinced that Object Oriented Programming actually reuses much code – but it does force it to be structured and organised. My code in this project, well, it isn’t. It’s suffered that sort of ‘evolutionary’ growth rather than proper, designed expansion. And some of it has to excapsulate an API that is archaic, irritating, and dangerous. (I’ve been debugging for memory leaks, dammit. Yes, this API forces me to allocate/deallocate memory).

What a sucky language. It really makes you appreciate Java/C#.

The Pain of VB6