Wednesday 24 April 2013

SharePoint 2013- Service Applications: Whats New?

  1. User Profile Service- The Better!
  2. App Management Service
  3. Machine Translation Service
  4. Word Automation Service
  5. Enhanced Business Connectivity Service
  6. Work Management Service
  7. Enhanced Excel Service
  8. Performance Point Services
  9. VISIO Service

Stay tuned for more updates on this post.

Sunday 20 January 2013

Working with Business Connectivity Services

Welcome to my first post on my SharePoint Blog. In this post we will talk about using Business Connectivity Services in SharePoint 2010. If you are thinking that this post is about introduction to BCS or its advantages then let me tell you it is not, this blog is about the commonly faced challenges while working with BCS. If you are new to BCS i would suggest you to go through this wonderful article about BCS. So lets get started!

Lets assume that by now you understand BCS and you have already created an external content type and an external list. Now as a developer the first thing that comes to my mind is i have a list ready can i use it like any other SPList? Unfortunately the answer is No.
Here are the list of challenges i faces while exploring an external list created using BCS

Challenge1: Permission denied to view the contents of external list on UI.
Possible Reason : You have not set the permissions on BCS entity.
Solution: In Central Admin go to Application Management, then Manage Service Applications. Open the Business Data Connectivity Service and select your entity, then select Set permission from the context menu or click on the Set Object Permission button. Once you have permission to the entity the error should go away.

Challenge2: Attaching an event receiver to external list.
Possible Reason: External Lists do not support event receivers
Solution: i created an event receiver in visual studio which would handle ItemCreated event and attached it to the external list. the code got deployed without any errors but on creating a new Item in DB or in list the receiver would never fire. after doing a lot of research i came to this conclusion that External lists do not support sharepoint event handlers. However i could not find any conclusive proof for this, hence the conclusion drawn is on bases of my findings.

Challenge 3: Accessing an external SPList through code
Possible Reason: Usage of 'Pass Through Authentication'
Description: here is one of the most interesting challenges i faced while working with an external list. i wanted to access and update my external list throught custom code so i wrote a simple sharepoint code of accessing the list but as soon as i iterated the ListItemCollection i got the following exception
:


System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
   at Microsoft.SharePoint.SPListDataSource.CheckUserIsAuthorized(SPBasePermissions perms)
 

Now this clearly indicated that the identity with which the list was being accessed didn't have sufficient permission to access the list. I was running the code under elevated privileges block and the app pool identity had all the required permissions on SharePoint list, external database and the BCS entity.

Solution: Here is what actually happened when i tried to access the list from my code, since i was accessing an external list which in turn accesses an external database so my Identity made two hops to get to external database. The first hop was made from my client machine to the server and the second one from server to external system. Since BCS uses 'Pass through Authentication' by default so it does not work with NTLM, as a result of this the second hop i.e from server to external system the Identity passed was 'Anonymous'.

Here is a wonderful article which explains this issue in detail and also helps one to understand the different authentication types used with External system.
The solution to this problem was usage of 'Secure Store' for BCS authentication which solved the double hop problem by storing the required credentials in SharePoint.

Storing credentials in Secure Store will enable BCS impersonation and thus the external system can be accessed with required permissions.

Setting up BCS with Secure Store Application impersonation
This article describes step by step procedure to do it.


Hope this post will be helpful to you all. have fun working with SharePoint!!

Sunday 16 September 2012

Coming Soon!


                                                             Watch This Space for More