Month: December 2012

Free ebook: Programming Windows 8 Apps with HTML, CSS, and JavaScript

For those of you looks at the new Windows 8 platform and how to use items like the WinJS, commanding UI, animations and sensors, it’s a really nice run down of everything you would want for building out a basic and elegant Windows 8 app on a mobile platform. I’ve skimmed the chapters and am now diligently working my way through the exercises…...

Read More

Microsoft Virtual Academy – Developing in HTML5 with JavaScript and CSS3 Jump Start, Free Certification for Exam 70-480

It’s been a while since I’ve written about this great little resource from Microsoft.  I originally wrote about their launch here.  Since then they’ve had some great training courses on SharePoint Online and Office 365.  Now they’re at it again with some great coursework from Jeremy Foster and Michael Palermo and I’m working my way through their excellent course on HTML5, JavaScript and CSS3. Here is the course: https://www.microsoftvirtualacademy.com/tracks/developing-html5-apps-jump-start This course provides an accelerated introduction to HTML5, CSS3, and JavaScript and helps students gain basic HTML5/CSS3/JavaScript programming skills. This course is an entry point into both the Web application...

Read More

PowerShell 3.0 (KB2506143) and SharePoint 2010, Not There Yet

So a bit of a rant, but as it turns out installing the Windows Management Framework 3.0 (KB2506143) on a SharePoint 2010 server is not such a good idea. After installing the Windows Management Framework 3.0 on a SharePoint 2010 Server I can’t use the "SharePoint 2010 Management Shell" anymore.  SharePoint uses .NET 3.5 and PowerShell 3.0 uses .NET 4, so when I try to open the SharePoint management console and run a SharePoint cmdlet I get some fun errors that Microsoft SharePoint is not supported by Version 4.0 A PlatformNotSupportedException occured while trying to acquire the local farm: System.PlatformNotSupportedException: Microsoft SharePoint is not supported with version 4.0.30319.586 of the Microsoft .Net Runtime. at Microsoft.SharePoint.Administration.SPConfigurationDatabase.get_Farm() at Microsoft.SharePoint.Administration.SPFarm.FindLocal(SPFarm& farm, Boolean& isJoined) The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered. So thanks for the lack of warning… but the fix is easy enough: Open the Installed Updates on the server search for KB2506143 Uninstall Reboot Open PowerShell and type “(Get-Host).version”, you’ll see it is now running in 2.0 mode again. You would think that during the install process of the WMF 3.0 it might check for SharePoint components and at least give a warning, but as the PowerShell team says here: http://connect.microsoft.com/PowerShell/feedback/details/746908/powershell-3-0-and-sharepoint-2010 Posted by Microsoft on 6/7/2012 at 12:34 PM This is not an issue with Windows PowerShell. This is an issue with SharePoint 2010. The SharePoint...

Read More

Truncate all Items in an SPList in SharePoint Using ProcessBatchData Command

This came up recently in regards to some of our test systems, where we were testing one of our systems that used large amounts of rows in an SPList.  As we were adding items through a scripted process “someone” (ok, it was me…) fat-fingered one of the scripts and next thing I knew we had roughly 30K rows from the wrong test bank sitting in our testing system.  Rather than just delete the SPList and start over I thought that there must be a better way to just truncate the table.  All I could find were scripts that went through the item collection and called the .Delete() function on each item.  This delete process takes roughly a quarter of a second per item, with 30K items to delete we were looking at 2 hours to iterate through.  Not too bad, but not great when you’re sitting on a deadline.  So with a little investigation I found the ProcessBatchData function, which allows us to process multiple requests to the server per transaction.  Using this method we can pass XML formatted Collaborative Application Markup Language (CAML) that contains the commands, which consists of a Batch element and any number of subordinate Method elements that each specify a SharePoint Foundation remote procedure call (RPC) method. It worked so well that I wrote it up as my very first Gallery submission to MSDN....

Read More

SharePoint–Use PowerShell To Delete Audit Data From Farm

One of the companies I work for is very conscientious about the amount of resources used in their development and QA environments.  They also like to have their SDLC farms as close to production as possible without having to take up additional space that comes with a production farm, such as versions and audit data.  We can usually get a copy of the production database to mount to our SDLC farms, but we don’t need to take up all that space if we don’t have to. Removing versions from the farm is explained here: http://iedaddy.com/2011/11/sharepoint-powershelldelete-old-versions-of-documents-and-items/ It is a pretty straight forward command to limit/remove the number of versions on lists that have the feature turned on to one copy of the previous version where applicable. Now another set of production data we don’t need is the auditing data.  In order to remove this I use the following script, where the $user is set to your login ID as the Site Collection admin: $user = "<doman\user>" foreach ($site in get-spsite -Limit ALL) { if (($site.Owner.UserLogin -eq $user) -OR ($site.SecondaryContact.UserLogin -eq $user)) { Write-host 'Deleting audit data for site: ' $sc.URL $i = -350 do { Write-Host $site.URL ' - Delete day ' $i ' : ' ([System.DateTime]::Now.ToLocalTime().AddDays($i)) $site.audit.deleteentries([System.DateTime]::Now.ToLocalTime().AddDays($i)) $site.audit.update() $i++ } while ($i -le 1) } $site.Dispose() } The reason I check to see if I’m a site collection admin...

Read More