Archive for the ‘Programming’ Category

Tip: Visual Studio + Batch replace GUIDs

Monday, August 1st, 2011

A common method for creating Visual Studio-based SharePoint solutions is to actually create them in the SharePoint GUI first, and then save the site as a template, and import that .wsp file in to Visual Studio as a SharePoint project. This often saves a lot of the hard slog of starting from scratch in Visual Studio, but still giving you the reusability of Visual Studio based solution.

One small issue you may run in to though is the (re-)use of GUIDs in e.g., Site Columns. For safety, you may like to replace the GUIDs, but in the case where you have a lot to replace, doing this by hand could be cumbersome. Step up Visual Studio Macros. You can create a simple Macro to automate virtually any process. The only problem, in this case, though, is that my testing of macro-ing the Find/Replace was that I could easily find GUIDs in a file, but replacing them with a freshly generated one wasn’t obvious. So I created a custom macro.

(more…)

Powershell tip for updating document sets

Wednesday, July 20th, 2011

If you’re using the handy Document Sets feature in SharePoint 2010 you may run in to a small issue where you make some changes to your document set (e.g., add/remove content types from the allowed contents). When you do this, and push changes down to existing document sets, you’ll see a little yellow bar appear on each document set with the message

“Content Types that are available to this Document Set have been added or removed. Click here to update the Document Set.”

The reason is that the document set refresh date needs updating. Quite why SharePoint can’t manage this for you, is beyond me, but nevertheless, if you do click the yellow bar, it disappears. But it still remains for all your other document sets. Irritating. So here’s how to remove the little yellow bar with the message using Powershell. The neatest way is just to provision the document set.

(more…)

Set SharePoint BDC field value programmatically in Visual Studio workflow

Wednesday, June 16th, 2010

The Business Data Catalog (BDC) in SharePoint is a superb way of hooking up virtually any disparate system to SharePoint 2007. By defining the connection in to the system, you can expose any part of the system to SharePoint, and harness some of SharePoint’s real power – for example, its powerful search capabilities. Once you’ve created your connection (your Line Of Business [LOB] system), you can attach BDC columns to any list (e.g., document library) and you can, for example, have a document with a reference to your other system, so that you can permanently associate extra data to your document, without having to reproduce the information in SharePoint and create unnecessary duplication.

Using the BDC is beyond the scope of this post, but I’d like to cover an issue that I recently encountered when trying to work with the BDC and a document library. I had a fairly simple Visual Studio 2008 workflow that ran when a new item was created in the document library.

(more…)