Writing Windows Phone Apps for SharePoint
Join the DZone community and get the full member experience.Join For Free
writing a blog post after quite some time. (well frankly was thinking on what sort of post to write)
we have heard / seen / read about how windows phone has good sharepoint 2010 integration features as to how the office hub can integrate with your corporate intranet sharepoint site and how, you can leverage the sharepoint workspace capabilities in windows phone.
after reading about this, you’d say cool, can i write an app which speaks to my sharepoint site. well the answer is yes. but there are some changes that you need to to do on sharepoint site configuration.
“argh!!, making changes on sharepoint site, my boss(and/or system admin) will kill me! “.
was this your reaction ? (at least, that was my initial reaction).
in that case, this post might not be of that much help.
however, we can always host a cloud service that would help you get data from sharepoint and you can consume the data from this “middle man” cloud service. ( off course this does add up expenses that at the end of the day needs to be taken care off by some one)
so, why is that i cannot consume sharepoint service directly from my windows phone.
well it all began, when windows phone sdk team decided to omit ntlm auth support from the sdk, thus preventing us 3rd party developers from directly writing cool apps that speak to your sharepoint site.
“why did they do this to us? “ you ask!!, well frankly, i don’t have an answer to that.
but, there is a way out of this. how is that? well , all you got to do is enable forms based authentication for your sharepoint site.
how do i do that? there is a good article here . (remember, you need to be very very strong hearted to take up all these changes, as these changes might literally take down your sharepoint site. )
here’s a pictorial representation of auth mechanisms and sharepoint support for the same.
(stolen from paul stubbs blog on msdn, sorry!! )
well what story, the above diagram is trying to tell is:
sharepoint 2010 supports two different authentication modes.
1. classic mode (the loner left side branch, support ntlm authentication only)
2. claims based mode (the right side branch of the diagram above)
what you can realise is that if you use the claims based mode for creating your sharepoint web application, you can use any of the claims providers to authenticate yourself (in this case, your phone app’s code) to your sharepoint site. (off course, your system administrator can have hard time configuring the same, but lets not get into that )
once you have the infrastructure in place. all you got to do is use the sharepoint 2010 web services to access sharepoint lists etc.
in sharepoint, you cannot make any changes to a spsite until you are an authenticated user. so you need to log in programmatically to make changes such as adding list items, modifying ‘em etc.
for logging in , you can use the authentication.asmx web service to authenticate yourself.
(the spsite you are trying to access via your code needs to allow
form based authentication.) the authentication site is available at :
logging into sharepoint
here’s what happens when you visit a sharepoint site: (again stolen for paul stubbs’ blog , sorry again!!)
1. you visit a sharepoint site page.
2. you are redirected to the login page(this internally uses the authentication web service), you enter your credentials here.
3. the authentication service returns a security token(fedauth).
4. this security token is passed for all subsequent calls to the sharepoint site.
5. this security token is verified by the server for validity and then the server returns the requested resource.
how do i do this programatically?
well, for programmatically mimicking the above mentioned behaviour, you can write code that looks something like this:
Published at DZone with permission of Sudheendra Kovalam. See the original article here.
Opinions expressed by DZone contributors are their own.