2013-05-13

Error when installing Chocolatey - CreateDirectory

I had a small issue today, when I was attempting to install Chocolatey. The problem I had was a script error when running the @powershell command specified on Chocolateys website:

Exception calling "CreateDirectory" with "1" argument(s): "The given path's format is not supported."
At line:25 char:86
+ if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory <<<< ($tempDir)}
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Downloading http://chocolatey.org/api/v2/package/chocolatey/ to C:\Users\<machinename>\AppData\Local\Temp;c:\windows\temp\chocolatey\chocInstall\chocolatey.zip
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At line:31 char:25
+ $downloader.DownloadFile <<<< ($url, $file)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Extracting C:\Users\<machinename>\AppData\Local\Temp;c:\windows\temp\chocolatey\chocInstall\chocolatey.zip to ...
You cannot call a method on a null-valued expression.
At line:38 char:46
+ $destinationFolder.CopyHere($zipPackage.Items <<<< (),0x10)
    + CategoryInfo          : InvalidOperation: (Items:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Installing chocolatey on this machine
The term 'C:\Users\<machinename>\AppData\Local\Temp;c:\windows\temp\chocolatey\chocInstall\tools\chocolateyInstall.ps1' is not recognized as the name of a cmdlet, function, script fi
le, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:45 char:2
+ & <<<<  $chocInstallPS1
    + CategoryInfo          : ObjectNotFound: (C:\Users\<machinename>...ateyInstall.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Ensuring chocolatey commands are on the path

Resolution

I opened up the https://chocolatey.org/install.ps1 file, and browsed through it, to figure out what was going on, that was causing my error. 

When I stumbled upon

$chocTempDir = Join-Path $env:TEMP "chocolatey"


I figured, if the %TEMP% variable contained more than one directory, then the Powershell script wouldn't be able to figure out what path to use.
The I opened up my %TEMP% variable under System Environment Variables, and located the TEMP entry. And sure enough, there were no less than 3 seperate paths, two of which I didn't need, and thusly removed.

Next I re-opened my Command Prompt (which is a necessary step, so the Command Prompt has the newly updated %TEMP% information)
And Bingo! Install ran with no issues.


2013-03-17

Make Visual Studio 2012 look like Visual Studio 2010

The latest edition to the Visual Studio family of IDEs, Visual Studio 2012, introduced a whole new design scheme. Many people have cried about how the IDE SCREAMS at you in all-caps menu-text. And others were appalled by the gray-in-gray-in-gray colour scheme.

Personally, I don't so much mind the all-caps menu-text - I just mind that it is now suddenly impossible to quickly differentiate content in the Solution Explorer. The biggest problem, IMHO, is that you can no longer recognize the icons, and the lack of colour difference makes it even harder.

Of course there is a solution to this problem - and it's called: Visual Studio Icon Patcher. Follow the below steps, to have your beloved VS.NET 2010 icons back in your Solution Explorer:

Prerequisites: 
 - Visual Studio 2010 and 2012 installed.
 - No instances of the IDEs running.

Step 1. Go to http://vsip.codeplex.com
Step 2. Download the latest version of VSIP (Visual Studio Icon Patcher)
Step 3. Once downloaded, Unpack
Step 4. Execute VSIP.exe, and a console window will open:



Step 5. Press Enter, and a list of commands will appear in the console



Step 6. Enter "extract", (excluding the " characters), which will start the extraction process from Visual Studio 2010.



Step 7. Enter "inject", to start the injection process into Visual Studio 2012. This will take 5-15 seconds depending on your machine.



Step 8. Run Visual Studio 2012. And verify that it works.

Step 9. Enjoy!

Happy coding!





2012-11-23

SharePoint User Profile Synchronization Service stuck on Starting

This short post is a reference to the articles used while fixing a broken User Profile Synchronization Service. The problems arose when we had migrated our SharePoint database away from a single-server setup, with our WFE and DBs on the same server, in order to increase performance. What we experienced was that:

  1. The User Profile Synchronization Connection had vanished
  2. After tearing down the UPS as recommended by all articles we came across, and rebuilding it, the service was still failing to start.
  3. After going through all setup and credentials several times, it would end up in the same situation: Stuck on "Starting".
After troubleshooting for 20 hours, we came across an article that would make all the difference - but it might be different for you.

But here is a word of advise: follow the articles steps in every detail. Don't think you know better unless you actually know better.

Here are the articles that helped resolve our issue - which was that we had to set the FIM services to "Local System" before starting the service. This fixed our problem. And know that UPS is so unstable in the setup/provisioning phase that it MIGHT fail, and hang at starting, even if you did the setup correctly. If it does this, and you tried everything in these articles, try it again!

2012-10-13

Cheap SharePoint Video Training Options

I've been spending the better part of the last 6 months upping my skills in the SharePoint world. Now, since I   am a visual learner, I really prefer seeing things, to understand them. Which makes the below options perfect for me.

  • Pluralsight - Hardcore Developer Training
    You'll find a massive amount of training videos. Its mostly tailored towards .NET developers, but they are beginning to diverge into new areas. So if you are anything like me, this site will suit many of your needs, and you will spend countless hours sucking up new knowledge.
  • LearnDevNow.com
    We can call this your defacto training video site. It covers alot of basic stuff, and even some more advanced stuff. But I feel like they are lagging behind, producing new content way to slow
  • SharePoint-Videos.com
    You have the option of subscribing to their service getting full access to their training videos. Alternatively you can purchase DVD-sets on different sections of their content. Both options are nice. But for me I never really enjoyed the way the videos were structured compared to Pluralsight and LearnDevNow. But they definately have alot of content that will help you.
  • CBT Nuggets
    This source is tailored towards IT Pros, and you will find little or no development content here for the SharePoint platform. But if you are an IT Pro, and if you are looking for a source to help you complete a SharePoint certification, then this source will most definately help you.
  • Microsoft - Free Office Training at your desk
    Ofcourse Microsoft is a great source for learning about their products. In fact they offer a complete suite of training for the entire Office product line. I haven't had any use for this yet, so I can only advise you to go and have a look for yourself.
  • Pilothouse Consulting - SharePoint Training
    Another source I uncovered during my research - again, I haven't had a look at the actual quality, but they offer courses spanning from a normal Super user, to IT Pro and on to development - including both SharePoint 2007 and SharePoint 2010
  • SharePoint Solutions Training
    I wasn't really able to figure out much about this source - since they want you to enter your e-mail and such, before moving on to anything.
  • SharePoint Hosting
    A nice list of videos to help you with specific things.
I'll keep this list updated as I use the different sources. If you have additional sources you use, please post them in comments, and I'll be sure to add them, to create a more complete list.

2012-10-12

Removing the "Add new Item" link from a list view in Sharepoint 2010

A question I get alot from my user is "How do I remove the 'Add new item' link from the list?". They want people to still be able to add items - but in certain cases they just want to show information, with no links or other useless stuff.

In my first few attempts to do this, I didn't think it was possible - and I had resorted to some rather smelly hacks to remove the link from the HTML using jQuery, or by hiding the HTML elements via CSS in a Content Editor WebPart (CEWP).

Another way could be to simply query the content of the List with a Content Query WebPart (CQWP) - but that just adds to the confusion of where date is coming from - and probably a few other good arguments that I won't spend time finding.

My favorite method, and the Out-of-the-box (OOTB) method is: 

  1. Edit Webpart properties
  2. In the WebPart editor properties under List Views find the section Toolbar Type
  3. Change the Toolbar Type to No Toolbar
  4. Click OK

The "+ Add new Item" should now be gone.

Quirks or bugs in SharePoint with relations to this setting

I've found that in some cases, there would still be a green "+" visible. This is most likely caused by the list view being in a mode where it allows for Inline editing. I presume this is actually a bug, and just one of those edge-cases that haven't been tested properly by Microsoft. Or as I call it: Yet another SharePoint Gotcha.

In this case, I suggest you use one of the ugly hack options available


2012-10-11

Identity if ItemAdded or ItemUpdated is a DoumentSet in Event Receiver in SharePoint 2010

Often you will need to differentiate between what to do if a normal ListItem is added to your Document Library, or if it's a Document Set.

There are a few approaches you can use, one as bad as the other -- and I'm not quite sure if I like any of them. But in lack of anything better, here goes (written as helper methods):

Option #1:

private bool isItemAddedADocumentSet(SPItemEventProperties properties){  return properties.ListItem.ContentType.Name.Equals("DocSetName");}


Option #2:


private bool isItemAddedADocumentSet(SPItemEventProperties properties){  return properties.ListItem.ProgId.Equals("SharePoint.DocumentSet");}

Which is best really depends. If you only have to identify if it is a Content Type derived from a Document Set, then I would choose Option 2. In any other cases I would probably prefer Option 1, because your ability to differentiate is "nicer" (but still ugly).

Hope this helps :-)

2012-10-04

List of ListTemplateIDs for SharePoint

Sometimes I can't remember what a specific ListTemplateID is, and then it's nice to know that at 


I can find just that. And they were even nice enough to make the list sortable by name and by ID ascending or decending.

Thanks!