June 7, 2013

Building Windows Phone apps for SharePoint

Yes. I love Windows Phone and I (sometimes) hate SharePoint, I’ve my own personal reasons :)

But still, there are many enterprises who use SharePoint for various reasons like collaboration, document management and what not. Providing SharePoint access on mobile devices can result in high productivity for employees. Indeed, SharePoint does have Mobile interface exposed for every site, but look at the web-page and people will simply hate it even more.

 

(Image From TechNet)

So, why not make it beautiful by providing rich user interface? why not make it more productive by building customized SharePoint solutions and mobile application? Yes. We can.

When I tried building Windows Phone apps for SharePoint, the biggest hurdle was authentication as SharePoint gives various options like Claims/Forms/ACE, NTLM, MicrosoftOnline, etc.. And then calling REST APIs every now and then. Wictor Willen has written a nice blog about SharePoint online authentication and you can see how painful it is to make requests here and there just to do the authentication :( <yes, I’m a lazy programmer> :)

But, recently I found out that Microsoft has released an SDK for building such apps. You can download these SDKs as: Microsoft SharePoint SDK for Windows Phone 7.1 & Microsoft SharePoint SDK for Windows Phone 8. Personally, I’ll recommend SDK for 7.1 unless you’re using any specific features from Windows Phone 8.

Once you download and install the SDK, using it is straight forward – just like using SharePoint CSOM. You need to refer following assemblies to use SharePoint APIs in your project:

  • Microsoft.SharePoint.Client.Phone.dll

  • Microsoft.SharePoint.Client.Phone.Runtime.dll

  • Microsoft.SharePoint.Client.Phone.Auth.UI

  • Microsoft.SharePoint.Phone.Application.dll

You can find these assemblies at: %ProgramFiles(x86)%\Microsoft SDKs\SharePoint\v15.0\Phone\%ver.%\

As you refer these libraries, accessing SharePoint list inside a Windows Phone is very simple:

image

In this example, it will show you a mobile authentication page (shown below) as I’m using MicrosoftOnline authentication mode. Else, you can provide login box to get credentials from users.

loginbox

After providing correct credentials, user will be authenticated and Failed/Succeeded callbacks will be sexecuted. Here you can process the results.

image

I hope this blog post will help you to build more SharePoint Mobile apps.

Namaste

Mayur Tendulkar

1 comment:

Sienna Amelia said...

Yes this was an informative blog, Having a passion towards windows mobile application development I was digging for the same, now I have an idea to start with, I wish to thank Wilson for the blog on credentials.

Thanks for sharing.