February 2013 - Posts

My PowerShell posts always prove to be the most popular.  I showed all sorts of cool PowerShell tricks in my talk back at SPC12.  One of the things I covered was how to install and manage apps using PowerShell.  Since there is a corporate catalog and SharePoint store, you might not think you need to install apps with PowerShell, but your developers may choose to the app model for a future internal project, so as an IT Pro you need to know how to install the thing.  There are a lot of similarities to working with solution packages but there are several differences to be aware of.  The documentation on TechNet is pretty good, but putting it all together can be tricky.

Specific to PowerShell, there is some terminology to familiarize yourself with.  You’ll see these for parameter names so you need to know what they are otherwise you’ll find yourself confused.

  • App Package – physical file containing the app (.app file)
  • App – an instance of an app installed on a particular subsite

Along with the App, you’ll find an Id property that refers to a GUID of that particular app instance.  We’ll talk about that more when it comes to updates.

To begin installing app, we first install the .app file into a site collection and then we deploy the app to an individual subsite.  To install the app package, we use Import-SPAppPackage.  Specify the path to your app package (.app file) with the –Path parameter.  You’ll also need to specify which Site Collection will contain the app using the –Site parameter.  Finally, the Source parameter tells SharePoint where the app came from (SharePoint Store, Corporate Catalog, or Object Model).  I always specify a value of ObjectModel for my custom apps.  Here’s what the command looks like.  Assign the results of the command to variable so that you can use it in the next step.

$spapp = Import-SPAppPackage -Path .\spcdemoapp.app -Site http://server/sitecollection –Source ObjectModel

PowerShellAppImportSPAppPackage

You can always add –confirm:$false to avoid getting prompted.

Now you have the AppPackage installed, you can deploy an instance of it to a subsite using Install-SPApp.  You’ll need to provide a URL to the subsite using the –Web parameter and a reference to the imported app package.  That’s why we saved the results of the last command into $spapp.  Use the following command.

$instance = Install-SPApp -Web http://server/sitecollection/site -Identity $spapp

PowerShellAppInstallApp

Like always with PowerShell, no news is good news.  At this point, you should find the app installed on the Site Contents pages.

NewAppInstalled

Here’s what it looks like it is running.  This is mainly for reference when we start talking about updates.

NewAppDefaultPage

To determine what apps are installed on a particular subsite use Get-SPAppInstance.  This cmdlet can be executed three different ways.  You need the id of the App Instance to update, export, or remove it.   So often you combine it with a Where-Object command to get a reference to an app instance by name instead of by id.

$instance = Get-SPAppInstance -web http://server/sitecollection/site | Where-Object { $_.Title -eq "MyApp" }

PowerShellAppGetSPAppInstance

Once you have a reference to the App Instance, removing the app from a subsite is easy with Uninstall-SPAppInstance.

Uninstall-SPAppInstance -Identity $instance

PowerShellAppUninstallSPAppInstance

One nice feature of PowerShell is that you have the ability to export an installed app to a .app file using Export-SPAppPackage.  It takes a parameter named -App.  It expects the value from an instance called .App (so use Get-SPAppInstance as shown above).  You also want to specify where to save the file using the –Path parameter.

Export-SPAppPackage –App $instance.App –Path .\ExportApp.app

PowerShellAppExportSPAppPackage

When it comes to updating apps, that’s where things get a bit tricky.  Here is what you need to do:

  • Get a reference to the existing installed instance using Get-SPAppInstance shown earlier
  • Import the new app package with Import-SPAppPackage
  • Use Update-SPAppInstance with a reference to the imported app package and the existing instance

Here are the commands

$instance = Get-SPAppInstance -web http://server/sitecollection/site | Where-Object { $_.Title -eq "MyApp" }

$spappv2 = Import-SPAppPackage -Path .\myapp.app -Site http://server/sitecollection/site -Source ObjectModel

Update-SPAppInstance – Identity $instance –App $spappv2

PowerShellAppUpdateSPAppInstance

One thing you might have noticed by now is that there is no way to retrieve which app packages are installed nor is there any way to remove them using PowerShell.  This is a bit different than the way we deal with solution packages.  I suspect it cleans itself up, but I’m really not sure.  I hope these PowerShell commands prove to be useful to you.  Let me know if you run into any issues.

It’s not uncommon for users to want to move data from an Excel spreadsheet into a new SharePoint list.  There have been various techniques to achieve this, but Access 2013 provides a way to this pretty easily.  The process is pretty simple.  We create a new Access 2013 database and import the Excel data.  From there, we export it to SharePoint.  Let’s look at the process.  First, let’s take a look at my data in Excel.

ExcelDefaultData

To import it to SharePoint, start by creating a new blank Access 2013 database.  The name doesn’t matter.

AccessNewBlankDatabase

Now, we need to import the data from our Excel Spreadsheet.  This is a multi-step wizard process but it isn’t too complicated.  Go to the External Data tab and then click the Excel button under Import & Link.

AccessExternalDataExcelImportButton

On this step, browse to the path of your Excel file.  I typically use the Import option, but you could use Append, or Link depending on your needs.

AccessGetExternalDataExcel

On the next step, you’ll be prompted for details about the data in your spreadsheet. You’ll get a preview of your data.  It’s ideal if the first row of your spreadsheet has the column names.

AccessImportSpreadsheetWizard

On the next step, you can tweak the data types used in each column.  This is important to ensure SharePoint sets the types for the columns appropriately.  You’ll notice the format of your dates comes through weird but it will be ok in the end.

AccessImportSpreadsheetWizard2DataTypes

On this step, you can specify a primary key or create a new one.  I’m not sure if SharePoint pays attention to this or not when the list is created.

AccessImportSpreadsheetWizard3PrimaryKey

Finally, you can confirm the name of the table you want to create.

AccessImportSpreadsheetWizard4Name

At this point the data is now visible inside Access as you can see below.  Now, we want to create the SharePoint list using this data.  Under the Export section, click More and choose SharePoint List.

AccessExportToSharePointList

Now, a new wizard will guide you through importing the data in SharePoint.  First, you will need to provide the URL to the site as well as the name of the list.

AccessExportToSharePointListWizard

When it finishes, you’ll now see your data in SharePoint.  You’ll notice it provides it to you in a grid view that you can immediately begin editing.

ExcelImportedList

It seems to do a pretty good job of mapping to appropriate SharePoint column types as well.  Take a look and note how it used types of Single line of text, Date and Time, Number, and Currency.

ExcelListDataTypes

Keep in mind this is only an import process.  The data is not synchronized.  That means this will behave differently than taking an existing list and clicking the Export to Excel button.  This seems like a pretty simply way to get data from Excel into SharePoint.  I like it because it creates the list for you with little effort and it maps the data types for you.  Do you find this useful?  How do you import data from Excel?

I take my Surface RT everywhere and I do mean everywhere.  Whether it is lunch, the bar, the airplane, user group presentation, a client demo, if I am out and about, chances are I have my Surface RT with me.  In the past month or so (long before the Surface Pro) came out, I noticed this trend of people asking me if that was a Surface Pro.  After I sighed,  I would reply “No, it’s not and nor do I want one.”  The technology just isn’t there yet for us to not have to make a trade-off right now.  Today’s post is to explain why I chose what I did. 

If you look at the Help Me Choose page, most of my reasons are clear.  Let’s break it down.

ARM Processors

While uneducated reviewers out there are complaining about the Surface RT running on an ARM processor, I am praising it.  When I first heard that Windows was going to support ARM, I knew the significance.  This is what gives you a tablet device with no fan speed or heat concerns.  It also gives you ridiculously long battery life and connected standby.  I’ve used a Samsung Series 7 slate and it was heavy and sometimes loud.  I saw the issue back then and I knew this was the answer. I’m a big fan of ARM.

Battery Life

Seriously, the battery life on Surface RT is amazing.  They quote 8 hours, but I have used it all day at client meetings exclusively and then used it a couple of hours later at the bar and still had 20% left.  I am seriously impressed.  The Surface Pro unfortunately has significantly less battery life with reports between 3.5 and 5 hours.  This may be fine if you plan on using it as a laptop and you’re keeping it plugged in but I like the fact that I never have to worry about power on my Surface RT.  I charge it every other day typically and that is fine.

Connected Standby

This is the feature that makes your Windows RT device notify you of mail and other notifications when the device is “sleeping”.  That means I hear every mail that comes in and I get that Skype call (usually) just like an iPad does.  Surface Pro cannot do this because it goes into a true sleep just like your laptop does.

Instant Resume

Who has three seconds to wait for their device to come on every time they hit the button on top of it?  You do, if you bought Surface Pro.  I can turn the screen of my Surface RT on and off rapidly.

Apps

I am amazed at how many reviewers, said “ZOMG, the Surface RT can’t run Photoshop!”.  Really?  You’re dismissing the device because of this?  How many times have you ran Photoshop on your iPad?  And why would you run that on a tablet anyways?  I get it.  The Windows Store is still growing, but you can rest assure it will catch up to Apple and it’s five thousand fart apps.  The install base of Windows PCs, Tablets, and other devices is just to huge to ignore. 

When I think of this, I refer back to my post, "There’s an app for that, but does there need to be?”  No, there is not a Facebook app for Windows 8, but do I need one?  The reason they created one for mobile devices originally was the because the browser sucked.  Well, I don’t need one because I have a fully functional web browser on the device (you can debate whether you like it or not :) ).  When you use your laptop, do you wish there was a Facebook app there?  No, of course not.

For you power users out there, you can actually run some of your favorite desktop apps over remote desktop. I don’t mean inside a full screen window session.  I mean with Remote Apps which puts applications running on a remote server running seamlessly on your desktop.  In fact, right now I am typing this entire post using Windows Live Writer running off of a Windows Azure VM on my Surface RT.  Take a look at the screenshot below and notice how there isn’t any visible RDP window or anything like that.

image

So yes, that’s Visual Studio and Windows Live Writer running on my Surface RT desktop over RDP.  It works quite well (assuming you have an Internet connection).  Special thanks to @chakkaradeep for pointing out the post on this. 

I even have a RemoteApp set up for Outlook.  Yes, I agree the included Mail app is a bit painful.  Really, my main complaint about it is that it’s slow and unresponsive.  I’m hoping that will get better in the future.  However, you have to understand why that app exists.  It all comes back to Connected Standby.  Outlook doesn’t support it, so they built this app that does.  Sure, it could support it one of these days I am guessing, but it’s all a matter of priorities.  Outlook definitely isn’t touch friendly.

Cost

The Surface RT is already a significant investment at it’s price point.  With better hardware comes more cost of course.  In reality, it’s not much more than any previous slate devices based on an i5 processor.  You just have to decide what’s in your price range.

What about Surface Pro’s better hardware?

Like anything there is a trade-off.  Yes, the higher resolution display and pen would be nice, but I could do without for now.  Admittedly, I haven’t seen that display in person yet.  I think the feature gap between the two devices will get closer as time goes on.

Can Surface RT replace your laptop?

Sometimes!  When I am traveling, it’s often all I bring with me.  If I have a SharePoint demo, I try to use SharePoint Online or I will remote into my laptop or another server so it gets the job done.  I don’t write a ton of code any more so it’s ok that I don’t have Visual Studio running locally.  With RemoteApps though, you can see that you can work around it.  Take a look at this photo that I took before traveling a few weeks ago.

WP_000453

There you will see my Surface RT connected to a glowing USB hub (SharePoint branded) with a keyboard, mouse, and headset.  It’s also attached to a second monitor driving it at full resolution as a second screen.  Here I have a remote desktop connected to my laptop.  I’m getting actual work done.  Let’s see your iPad do that.

Can Surface RT replace your iPad?

At the risk of enraging the wrath of Apple fanbois, I’ll give you my opinion.  If you want to get real work done, absolutely.  If you want it to control your Sonos system or Directv receiver, not likely.  For work though, there really is no comparison.  Think back in the past to a meeting you have gone to right after someone you know first got their iPad.  They are over there diligently trying to use the iPad in some useful way at work.  Then, you see that person a few weeks later at another meeting and one of two things has happened.  Either a) they didn’t bring the iPad or b) you peak on their screen and they are on Facebook or are playing Angry Birds.  iPads are pretty decent for consumer home use, but for most people they aren’t going to help you get your job done.

Let’s face it Apple hasn’t done much since Steve Jobs died.  I am hearing even the most die hard fans question their direction and capability to innovate.  Simply making things thinner and lighter isn’t good enough for people.  I think the Surface RT is superior to other devices in many ways.  Does it have it’s issues?  Sure, but this is Microsoft’s market to capture.  Unfortunately, the marketing Microsoft is doing is just not effective so people just don’t know about what these devices do.  When the word gets out, maybe we’ll see something.

What do you all think?  Am I completely off base here?  Does the RT meet your needs?  Did you hold out for the Pro or did you go with something else?  Leave your feedback.

Maybe I should have been a gadget reviewer for a living.  If anyone wants to send me hardware for me to write my opinion about, I’ll take it. :)

I had a great time last night at the Austin SharePoint Users Group (@AustinSPUG).  We had a great turnout and we had a good discussion of what the publication process looks like with SharePoint 2013 Apps in the Office Store.  Austin has a very friendly group of people.  Never had I had so many people come up and thank me afterwards for speaking.  Now, it makes me look forward to speaking at SharePoint Saturday Austin on 3/2.  As promised, my slides are attached and are available on SlideShare.

Publishing SharePoint 2013 Apps to the Office Store

The great thing about living in Texas is that there is three SharePoint users groups less than three hours away from me.  I’m excited to have the opportunity to be speaking in Austin twice in the next couple weeks.  The first talk is tomorrow night (2/13 at 6:00 pm) at the Austin SharePoint Users Group (@AustinSPUG) where I’ll be speaking about my experience publishing SharePoint 2013 Apps to the Office Store.  It’s at the Microsoft office in Austin. 

Then, I’ll be making a return trip on 3/2 for SharePoint Saturday Austin (@SPSATX) at the Etter-Harbin Alumni Center (Map).  There, I’ll be talking about new development features in Visual Studio 2012.  This talk will cover features that developers can take advantage of for both SharePoint 2010 and SharePoint 2013.  I’m looking forward to seeing everyone.  See you there!

At SPC12, I gave a talk about PowerShell in SharePoint 2013.  In that talk I upgraded a SharePoint 2010 site collection to SharePoint 2013.  I wanted to follow-up with a blog post showing the steps involved.  To begin the process, I have restored a copy of my content database from my SharePoint 2010 environment on the SQL Server for my SharePoint 2013 environment.  The first thing we need to do is mount the content database with Mount-SPContentDatabase. In SharePoint 2010, this process would actually update the database and perform the upgrade.  Now, it actually just attaches the database but leaves the site running in SharePoint 2010 mode.  Effectively you are running a full copy of SharePoint 2010 inside SharePoint 2013.  You can do this and upgrade each site collection one at a time to make the transition process a bit easier. 

Typically, when you are doing this, you’ll execute Test-SPContentDatabase first and resolve any reported issues.  Just like in SharePoint 2010, you need to install all of your customizations via solution package prior to mounting.  Test-SPContentDatabase can help you find some of these customizations if they are missing.  For simplicity, I am going to leave that out of my example today.  Mount-SPContentDatabase typically takes two parameters:  the name of the database and the URL of the Web Application to bind it to.  Here is what the command looks like.

Mount-SPContentDatabase –Name DatabaseName –WebApplication http://server

When it runs, you’ll see a progress indicator.

MountSPContentDatabaseProgress

When it finishes, you’ll likely have errors.  You can track them down and re-mount.  More than likely you’ll always have some kind of error regardless of how hard you try.

MountSPContentDatabaseCompleteWithErrors

Now you can go to the site in your web browser.  You’ll see your existing site running in SharePoint 2010 mode along with a banner prompting to start the site collection upgrade process.

UpgradeSharePoint2010Mode

You can start the upgrade process right there in the browser, but we want to use PowerShell.   We can see the upgrade status of our site collections using Get-SPSite.  This cmdlet has been updated to show you the current version (ComaptibilityLevel) of the site collection.  A value of 14 represents SharePoint 2010 while a value of 15 represents SharePoint 2013.

Get-SPSite

PowerShellGetSPSite

To upgrade a site collection, test it out first using Test-SPSite.  Like Test-SPContentDatabase, this command can help you identify any particular issues.  In my case, I am going to upgrade my root site collection.

Test-SPSite http://server/sitecollection

PowerShellTestSPSite

SharePoint 2013 has a new concept for the upgrade evaluation site collection.  Effectively this process schedules a job to copy your site collection, upgrade it, and then optionally notify you (if you add the –email parameter).  You don’t have to use this, but it’s a good way to test things out if you have a tricky site with a lot of customizations.

Request-SPUpgradeEvaluationSite http://server/sitecollection

Executing the command simply returns you to a command prompt.  Later a job will fire off and create the upgrade evaluation site collection.  This appears to be controlled by the Create Upgrade Evaluation Site Collections job.  It only executes once a day so if you want to get your upgrade evaluation site faster, you can go manually run it.  After it completes, you can visit your site by appending –eval to your site collection name (i.e.: http://server/sitecollection-eval).  When you visit the site you’ll notice the warning bar at the top telling users that this is only temporary.  After 30 days or so the site will get deleted automatically.

UpgradeEvaluationSiteCollection

As you see I have an error in a web part that I need to correct.  This is why upgrade site collections can be useful in finding issues before cutting over.

Let’s upgrade out site collection directly now.  I only received warnings from Test-SPSite so I am going to proceed with the upgrade and assume everything is going to work fine. :)  We use Upgrade-SPSite to make this happen.  Pass the URL to the site collection and be sure and include –VersionUpgrade.  It won’t upgrade to the new version if you leave off that parameter.

Upgrade-SPSite http://server/sitecollection –VersionUpgrade

PowerShellUpgradeSPSiteInProgress

Depending on the size of your site collection, it may take some time.  When it finishes, you’ll see something similar to the screen below.

PowerShellUpgradeSPSiteComplete

Now, we can visit our upgraded site in the browser.

UpgradedSiteCollection

Site Collections Upgrades are a powerful new feature in SharePoint 2013 which I believe will really make the process smoother.  Keep in mind, you can also use the new Copy-SPSite cmdlet to make a copy of your site collection and perform some tests there.