Saturday, January 19, 2013

Windows Phone Apps, SharePoint 2013 Online and Getting Free Development Started Using Visual Studio Express

Over at Christian Heindel's blog I read the post about authenticating with SharePoint 2013 from a Windows Phone app and thought I'd give it a try.

If you are impatient and just want to start developing here is what you have to do to get your development system on Windows 8 up and running:

Setting up the Development Environment

First I needed to set up my development environment. My operating system is a Windows 8 Pro and has until today been SharePoint-free. I used only Express editions of Visual Studio which you can get for free here.


Since I had already developed Windows Phone apps I had Visual Studio Express 2012 for Windows Phone installed and ready.

Next I needed to install the Microsoft SharePoint SDK for Windows Phone to get the necessary SharePoint assemblies. Seems like version 7.1 of the SDK is the only one available. Quote from the download page:
The Preview SDK installs Windows Phone CSOM libraries for Windows Phone, SharePoint Auth library for Windows Phone and Windows Phone Project Templates, which can be used to build Windows Phone 7.1 Applications against SharePoint 2013 Preview or SharePoint 2010.
The SDK setup did not recognize my Visual Studio Express 2012 and demanded a Visual Studio 2010 to be present. I searched some time for a newer SDK but did not find any.

So I sighed and installed Visual C# Express 2010. Next I installed SP1 via Windows Update so I could install Windows Phone SDK 7.1.


On Windows 8 I got a compatibility warning for the Windows Phone SDK and an error at the end of the setup which is related to XNA Game Studio. Just ignore it.

After the phone SDK I could finally install Microsoft SharePoint SDK Preview for Windows Phone 7.1. (Update: Install the final version instead, see below for details.)

The SharePoint SDK setup put the following assemblies to C:\Program Files (x86)\Microsoft SDKs\SharePoint\v15.0\Phone\v7.1\Libraries:
  • Microsoft.ProjectServer.Client.Phone.dll
  • Microsoft.SharePoint.Client.Phone.dll
  • Microsoft.SharePoint.Client.Phone.Runtime.dll
  • Microsoft.Sharepoint.Client.Taxonomy.Phone.dll
  • Microsoft.Sharepoint.Client.Userprofiles.Phone.dll
  • Microsoft.SharePoint.Phone.Application.dll

Quick Win Using One of the Sample Apps

You can download sample solutions from the Dev Center Page Christian linked to.

I chose the sample solution SharePoint 2013: Store and retrieve SharePoint list items on a Windows Phone since it sounded like it would be easy to test.

If you don't have a SharePoint 2013 Online site to test you can sign up for free for an Office 365 Developer Site.

After downloading the solution I opened it with Visual Studio Express 2012 for Windows Phone and built it - which succeeded without any problems. This was surprising since I expected that I have to add Microsoft.SharePoint.Client.Phone.Auth.UI.dll like Christian needed to do.

I didn't have to change the sample at all, it worked right out of the box. Which is good since Microsoft.SharePoint.Client.Phone.Auth.UI.dll is not present anywhere on my machine. The SharePoint-related references of the sample app look like this:


Apparently Authenticator in my case is coming from Microsoft.SharePoint.Client.Phone.Runtime.dll.

Now it was time to test, so I created a list, added a test item, modified TargetSiteUrl and TargetList in the sample app accordingly and that's it:

Hello SharePoint in the Cloud!

Update: SharePoint Preview SDK for Windows Phone 7.1 vs. Final Version

Seems like MSDN and the Sample Solutions need to be updated - they link to and reference the SharePoint Preview SDK while there is already the final version available!

The SharePoint SDK for Windows Phone 7.1 is available for download.

When building the sample projects you will now get errors for type Authenticator:
Error 1 The type or namespace name 'Authenticator' could not be found (are you missing a using directive or an assembly reference?)
The solution indeed is to add a reference to Microsoft.SharePoint.Client.Phone.Auth.UI. There are two other assemblies which are new in the final SDK, so if you are missing these make sure you don't have the preview installed:
  • Microsoft.SharePoint.Client.Search.Applications.Phone.dll
  • Microsoft.SharePoint.Client.Search.Phone.dll
Thanks Christian in the comments.

6 comments:

  1. I'm glad that my post gave you the right motivation to try it yourself. (Beware of implementing the idea I've told you about on Friday.! ;-) )

    According to your blog post, you've installed the *preview* bits from "Microsoft SharePoint SDK Preview for Windows Phone 7.1" and not the final version "Microsoft SharePoint SDK for Windows Phone 7.1".

    Can you please double check and see, if you get the same problem when you deinstall the Preview SDK ( https://www.microsoft.com/en-us/download/details.aspx?id=30476 ) and install the final one. ( https://www.microsoft.com/en-us/download/details.aspx?id=35475 )

    - Christian

    ReplyDelete
    Replies
    1. Thanks, that's the solution. They changed the assemblies.

      And no worries, your idea is yours to implement.

      Delete
  2. I am William..I just browsing through some blogs and came across yours!Excellent blog, good to see someone actually uses for quality posts.Your site kept me on for a few minutes unlike the rest :)Keep up the good work!Thanks for sharing a important information on sharepoint

    ReplyDelete
  3. Microsoft has released an official SharePoint app for Windows Phone, enabling users to stay connected with colleagues using service backend functionality and features. Windows Phone has the advantage of the competing mobile platforms when it comes to document processing.

    ReplyDelete
  4. The sharepoint sdk for windows phone 8 is also here now...

    http://www.microsoft.com/en-us/download/details.aspx?id=36818

    ReplyDelete
  5. This is a very good convey of information how step by step process helps any SharePoint developer to run SharePoint program in a window’s latest version.

    ReplyDelete