Icons & Illustrations for SharePoint Architecture Diagrams

A picture is worth a thousand words.

Like me if you spend a lot of time writing up functional specs and architecture diagrams and are looking for ways to convey your ideas through illustrations, here are a few pointers.

Search the Hive

The 12 (now 14) hive has a wealth of icons. The images in the png formats are the slightly larger, higher resolution ones. You can find them at 14\TEMPLATE\IMAGES. Here are a few samples.

14 Hive Icons

 

Visio 2010 SharePoint Workflows

These are new ones, the icons in this stencil are vector based and can be resized without blurring.

SharePoint Workflow Actions

 

Google / Bing Image Search

Set the filter type to icon and clipart and you do come across some good gems. Remember to check the copyright on the images before using them.

 

SmartArt in PowerPoint 2007 & 2010

The SmartArts are a powerful tool to illustrate your ideas and need to be used wisely.

SmartArt

Play around with the various styles to get the look you want. Here’s one I built for a functional spec recently.

SmartArt Picture

 

Here’s a diagram I built today to document a web part. The icons came from Google, the Hive and good old Visio.

Filter Web Part

 

Snipping Tool

My favourite tool to get screen grabs, and save them to files if necessary, is the Snipping tool. This has been built into Windows since XP SP2 and is a really handy utility. To get to it just type snip in the Start menu and you should see the Snipping Tool.

One of the first things I do on a new installation is to disable the Red outline from the Option menu. FYI: All of the images above were snipped and saved to disk using the Snipping Tool before being inserted into Live Writer.

SnippingTool

Icons & Illustrations for SharePoint Architecture Diagrams

.NET 4 Free Beta Exam Vouchers

Looks like I somehow missed this. Free vouchers for the .NET 4 (Visual Studio 2010 Beta Exams) are available online in the Born to Learn blog.

I couldn’t register for the 71-515 (TS: Web Application Development with .NET 4) exam as it was booked up but there were seats still available for the other two exams that I registered for today.

You need to take the exams before 30-Apr, so you have almost a month to get prepared. You can also make use for the pilot beta preparation resources that other candidates are sharing, see the ‘Preparing for the Visual Studion 2010 beta exams’ post by Krista.

.NET 4 Free Beta Exam Vouchers

SharePoint Client on Windows 7 Phone

Yesterday I was excited when I could download the Win 7 dev kit, but that turned to disappointment when I realised that I could only run the application that I deployed and not try out the other stuff on the phone.

Today, thanks to Dan Ardelean I was able to unlock the Windows 7 Phone emulator. So here I was poking around only to be pleasantly surprised to see the SharePoint client built in to the phone.

Here are the first screenshots you’ll see of the Win7Phone SharePoint client.

SharePointWorkspace

MySiteLinks

SharePoint Client

SharePoint Client on Windows 7 Phone

Get Safe File Name

Here’s a quick utility that might come in handy. More than once I’ve seen code where the invalid chars were hard coded. The Path.GetInvalidFilenameChars has been in the .NET Framework since 2.0.

The thing is you would expect something like this to be in the framework itself.

        /// <summary>
        /// Removes invalid characters from the string that is passed in.
        /// </summary>
        /// <param name="name">The name of the file.</param>
        /// <returns>The safe name with invalid chars removed.</returns>
        public static string GetSafeFileName(string name)
        {
            var safeName = new StringBuilder();
            foreach (var c in name)
            {
                if ((from p in Path.GetInvalidFileNameChars() where p == c select p).Count() == 0)
                {
                    safeName.Append(c);
                }
            }
            return safeName.ToString();
        }

Chris Martin posted an even tighter version of this code in the comments below. Thanks Chris.

var invalid = Path.GetInvalidFileNameChars();

return new string((from p in name 
        where !invalid.Contains(p) select p).ToArray());
Get Safe File Name

SharpSvn: A Primer

The SharpSvn library basically gives you a .NET interface to all the operations that you would normally perform through a tool like TortoiseSVN.

I found myself needing this exact library while writing a tool that changes files that have been checked out from SVN.

The problem with manipulating files that are under SVN is that you need to be careful about renaming files (and sometimes even deleting). If you don’t do it through the SVN api then you will end up with duplicates files/folders in SVN since SVN thinks that it’s a new file.

To solve this I finally got a chance to crack open the SharpSVN library which is used by my favourite AnkhSVN.

1. Download the latest library from http://sharpsvn.open.collab.net/. You have to pick between either 1.5 or 1.6. I went with 1.6 and didn’t run into any issues. I think this is based on the version of the SVN server that your connecting to.

2. In your Visual Studio project add a reference to the following assemblies.
– SharpSvn.dll
– SharpSvn.UI.dll (Only needed if you need the UI to prompt for login)

3. If like me your building on a 64 bit OS and you want your app to run on a 32 bit OS, make sure the project that references the SharpSvn.dll is set to Build for the x86 Platform. (Build –> Configuration Manager – Solution Platform)

4. Write your code using the SvnClient object. Here are some samples from the SharpSvn Wiki and some that I wrote.

CheckOut

public void CheckOut()
{
  using (SvnClient client = new SvnClient())
  {
     client.CheckOut(
       new Uri("http://svn.collab.net/repos/svn/trunk/contrib"),
       @"c:\wc");
  } 
}

Add new files to the working copy

using(SvnClient client = new SvnClient())
{
  SvnAddArgs args = new SvnAddArgs();
  // TODO: Set optional settings on args

  client.Add(@"C:\file\in\workingcopy", args);
}

Check if a given path is a valid SVN working copy

public static bool IsWorkingCopy(string path)
{
    using (var client = GetSvnClient())
    {
        var uri = client.GetUriFromWorkingCopy(path);

        return uri != null;
    }
}

Find out if a particular folder/file has been marked for deletion.

public static bool IsDeleted(string path)
{
    if(!IsWorkingCopy(path)) return false;

    bool isDeleted;
    using (var client = GetSvnClient())
    {
        Collection<SvnStatusEventArgs> args;
        client.GetStatus(path, out args);
        isDeleted = args.Count > 0 && args[0].LocalContentStatus == SvnStatus.Deleted;
    }
    return isDeleted;
}
 
What’s even more awesome about the guys who wrote this library actively support it (even over twitter, thanks http://twitter.com/srijken!).
 
And that was even before I found out that they have a ready made .wxs file for integrating the .dlls into my WiX installer package. Awesome!
SharpSvn: A Primer

Workflow does not start automatically when bulk inserting items

This had me tripped for a while. I was bulk inserting items (~800) to a list which had event receivers as well as a workflow attached.

The problem was that the workflow was not being triggered. Or if it did it just hung at In Progress.

After poking around for more than an hour I discovered that if I inserted a single item it worked. So to fix the issue I added a ten second sleep (Thread.Sleep) between the inserts and the workflows are triggering away happily.

Workflow does not start automatically when bulk inserting items