Thursday, July 15, 2010

Error message when you try to start User Profile Synchronization in SharePoint 2010: An update conflict has occurred, and you must re-try this action. The object UserProfileApplication Name=User Profile Service Application was updated by [User]

Symptoms:

When you try to start User Profile Synchronization (Full/Incremental) or start the "User Profile Synchronization Service" found under "Services on server" in SharePoint 2010, you receive an error
"An update conflict has occurred, and you must re-try this action. The object UserProfileApplication Name=User Profile Service Application was updated by [User]"

Full details about this error as it is logged in various places has been detailed below:

ULS:

ConcurrencyException: Old Version : 241817 New Version : 241817 99a7a04b-0297-4ecc-9621-a38b05c8ccce Microsoft.SharePoint.Administration.SPUpdatedConcurrencyException: An update conflict has occurred, and you must re-try this action. The object UserProfileApplication Name=User Profile Service Application was updated by [User], in the OWSTIMER (3456) process, on machine [Server Name]

ULS:

SharePoint Foundation Runtime Unexpected Microsoft.SharePoint.Administration.SPUpdatedConcurrencyException: An update conflict has occurred, and you must re-try this action. The object UserProfileApplication Name=User Profile Service Application was updated by [User], in the OWSTIMER (3456) process, on machine [Server Name]

Event Viewer:

The Event 6482 is logged once every minute and has the following data:
An update conflict has occurred, and you must re-try this action. The object SearchDataAccessServiceInstance was updated by [User], in the OWSTIMER (1756) process, on machine [Server Name].

Troubleshooting:

Our initial thoughts went in the direction of Active Directory. We have started investigating whether any changes have been made to the AD that may be causing the issue. After confirming that no AD changes have been made, we tried to see why it is failing using the "Microsoft Forefront Identity Manager 2010" as it provides step by step detail about what happens. The "Microsoft Forefront Identity Manager 2010" failed to start because the "User Profile Synchronization Service" and the forefront windows services (Forefront Identity Manager Service and Forefront Identity Manager Synchronization Service) were in stopped state. When we tried to start the "User Profile Synchronization Service", we got the same error detailed above.
We took the whole farm backup and investigated further.

Cause:

This issue occurs if the contents of the file system cache on the front-end servers are newer than the contents of the configuration database. After you perform a system recovery, you may have to manually clear the file system cache on the local server.

Resolution:
To resolve this issue, clear the file system cache on all servers in the server farm on which the Windows SharePoint Services Timer service is running.

Microsoft has provided a step by step procedure on clearing file system cache from the SharePoint front-end servers in this kb article.


  1. Stop the Windows SharePoint Services Timer service (Found in Windows Services)
  2. Navigate to the cache folder
    In Windows Server 2008, the configuration cache is in the following location:
    Drive:\ProgramData\Microsoft\SharePoint\Config
    In Windows Server 2003, the configuration cache is in the following location:
    Drive:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config
    Locate the folder that has the file "Cache.ini"
    (Note: The Application Data folder may be hidden. To view the hidden folder, change the folder options as required)
  3.  Back up the Cache.ini file.
  4. Delete all the XML configuration files in the GUID folder. Do this so that you can verify that the GUID folder is replaced by new XML configuration files when the cache is rebuilt.
  5. Note When you empty the configuration cache in the GUID folder, make sure that you do not delete the GUID folder and the Cache.ini file that is located in the GUID folder.
  6. Double-click the Cache.ini file.
  7. On the Edit menu, click Select All. On the Edit menu, click Delete. Type 1, and then click Save on the File menu. On the File menu, click Exit.
  8. Start the Windows SharePoint Services Timer service
  9. Note The file system cache is re-created after you perform this procedure. Make sure that you perform this procedure on all servers in the server farm.
  10. Make sure that the Cache.ini file in the GUID folder now contains its previous value. For example, make sure that the value of the Cache.ini file is not 1.

Wednesday, July 7, 2010

How to create an External Content Type in SharePoint Designer 2010 using Business Connectivity Services(BCS) and fix issues that arise on the way

Scenario:
How to create an External Content Type in SharePoint Designer 2010 using Business Connectivity Services(BCS) and fix issues that arise on the way

Explanation:
In this walkthrough I will explain how to use Sharepoint Server 2010 Business Connectivity Services(BCS) feature to access external business data (SQL Server 2008 in this example). This simple step-by-step will also help you fix the issues that you might encounter on the way

Create Model using SharePoint Designer

SPD includes functionality to design the application definition model visually. Based on the options selected on UI, it generates the xml metadata in the background. Using ECT Designer in SPD you can discover database, point to the table, view, or stored procedure that will perform the operations, and then return the required data and use it to create external content type without writing any code or XML. Follow the steps below to create the ECT:

Open up SharePoint Designer 2010 and click on "External Content Types"

External Content Types

To create a new external content type, click on "New External Content Type" in the ribbon



Click on the link "Click here to discover external data sources and define operations". This will open up the windows to define the connection to AW database and operations for the ECT.

Click "Add Connection" under External Data Source section and choose Data Source Type as SQL Server. This brings up the SQL connection properties dialog. In this we are connecting using SQL Server provider to get data.

Define Operations on External System

SPD provides option to create the view for all common operations available in BCS or it can create operations for specific operation.

Following two minimum operations are required to fetch data from backend using BCS:

  • Query Item List method which gets the list of records and work as finder method
  • Read Item method which gets data for specific record and work as SpecificFinder method

Choose the appropriate external data connection and then the database table. Right click on the selected table and create operations as required. In this example, I have created all the operations that are possible through SPD 2010.

External Data Connection

After adding all the operations, we should be able to see something like in the image below:



Create External List based on External Content Type

You can create an external content type by using Microsoft SharePoint Designer 2010 or the browser. Follow the steps given below to create list using browser.

  1. Open the SharePoint site in which you would like to create the external list in browser.
  2. Go to Site Actions, View All Site Content.
  3. Click the Create button. In the Custom Lists section, click External List.
  4. On the New page, type the list name and description for the new external list.
  5. The Data source configuration section displays a text box and an external content type picker. Use the picker to choose the external content type. Select the newly created external content type and then click OK.
  6. Click Create.
This creates the external list. You can now navigate to the new list in the SharePoint site and view/edit items.





All good so far. But you can expect to see the below error when we try to access the external list that has been just created.

Access Denied Error

This is because the BDC service that we just created has not been given permissions yet.

Open Central Admin > Application Management > Manage Service Applications > Business Data Connectivity Service and select the check box next to the service that we just created and then click "Set Object Permissions". Add the user(s) that need to be given access as in the image below:



Go back to the external list and refresh the page if required.
Now we see a new error "Login failed for user 'NT Authority\ANONYMOUS LOGON" as in the image below:

Login failed error

The above error occured because by default, when we create the BDC definition in SPD 2010, the authentication mode is set to "User's Identity".

The "Connect with User’s Identity" is the "PassThrough" authentication mode we had in MOSS 2007 BDC. The other 2 relates to SSO. Now that we have Secure Store Service Application, we can use "Connect with Impersonated Windows Identity" OR if we are using claims token we can use "Connect with Impersonated Custom Identity"

Inorder to access the data from the external data connection, one way of fixing the above issue is to change the Authentication Mode from "User's Identity" to "BDC Identity".

So open up the external content type in SPD 2010 and change the authentication mode.



Now we end up with a new error:

Change Authentication Mode Error

Below are steps we need to follow to get this corrected!

We have to first enable BCS model to accept "RevertToSelf" as one of the authentication modes. Yes, it’s disabled by default. We can do this using SharePoint 2010 Management Console.

The "ReverToSelfAllowed" property is set to false by default. We can now change it to true using the below script:

$bdc = Get-SPServiceApplication | where {$_ -match "Business Data Connectivity Service"};
$bdc.RevertToSelfAllowed = $true;
$bdc.Update();

So finally when we hit the list again, we should be able to see the rows from the SQL Server table as items in the external list that we have created. Also notice the highlighted top left corner in the image below.
We are able to see the options "New Item", "View Item", "Edit Item" and "Delete Item" because I have created all the operations from SPD 2010 when I created the BDC definition above. If you skip any of the operations for example "Delete Operation", the "Delete Item" option will be diabled in the ribbon.


Friday, July 2, 2010

Effect of moving PerformancePoint Service from one server in a SharePoint 2010 farm to another..

Scenario:
We have 2 WFE servers in a SharePoint 2010 farm.
We had PerformancePoint Service residing on WFE1 and for enhancing performance, we needed to move it to WFE2.
Before moving the service we had one dashboard page that was using PerformancePoint Service.



After movied the services from WFE1 to WFE2, all the web parts on the page disappeared and we ended up with the below:



Explanation:
Plan your farm well in advance and be cautious and take the necessary backups before attempting to move the services from one server to the other in a farm.