Showing posts with label SharePoint 2010 Business Connectivity Services. Show all posts
Showing posts with label SharePoint 2010 Business Connectivity Services. Show all posts

Thursday, 28 July 2011

How to force a SharePoint 2010 Business Connectivity Services (BCS) Client Cache to rebuild

WARNING! This tip involves potential loss of data.
The Business Connectivity Services (BCS) Client Cache is a combination of PST files and a SQL Server Compact Edition database - that allows for you to operate with Business data while in disconnected or limited-connection scenarios.

It contains all the subscription information and data for any items that you have made available offline via Business Connectivity Services. However, there is no official way of flushing this cache - your BusinessDataCache.sdf file will just keep growing and growing ad infinitum. You can query this data by connecting to it via Visual Studio 2010 via the Server Explorer/Data Connections task pane.(For reference, the Schema of the BCS Client Business Data Cache is shown below)


At the risk of data loss (if you have any unsynched items), there is a way of recreating your cache without deleting your whole Windows Logon profile. This is as follows:

  1. Uninstall any Office Add-ins you have e.g. Outlook Addins that use the BCS cache or create subscriptions in the BCS cache.
  2. Kill the BCSSync.exe process in memory using Windows task manager.
  3. Go to the following folder on the machine:
    %userprofile%\AppData\Local\Microsoft\BCS
  4. Rename BusinessDataCache.sdf to zzBusinessDataCache.sdf
  5. Run "%ProgramFiles%\Microsoft Office\Office14\BCSSync.exe" /Restart /Activation /RestartApps to restart the BCS Synchronization service.
  6. Your BusinessDataCache.sdf  file will be regenerated.
DDK

How to Troubleshoot Business Connectivity Services (BCS) in SharePoint 2010 using Performance Monitor Data Collector Sets

When dealing with Business Connectivity Services (BCS) errors (especially if they are occurring on Offline clients such as Outlook), the Event Log and SharePoint ULS Logs don't give you the whole picture.

To get a full verbose breakdown as to why your configuration or code is generating errors, you need to use Windows Performance Monitor (perfmon) to generate a verbose trace to get the full details and stack traces that are often needed to diagnose issues.

To set up an Event Trace on BCS you can do the following:
  1. Start Up Performance Monitor by typing "perfmon" at the Windows Start Prompt.
  2. In Windows Performance Monitor, Expand the "User Defined Node" and then Right-Click and Choose "New Collector Set"

  3. In the First Screen of the Wizard, Name the Collector Set (e.g. BCSCollectorSet). Choose the "Create Manually (Advanced)" radio button.
  4. When asked "What type of data do you want to include?", choose "Event Trace Data"

  5. When asked "Which event trace providers would you like to enable?", select the "Microsoft-Office-Business Connectivity Services" and the "Microsoft-SharePoint-Products-Business Connectivity Services" providers. If you are using Duet Enterprise, you may also want to add the "Duet Enterprise" Event Provider.

  6. Click "Finish" to Leave the other settings at the defaults.
  7. Start your trace by clicking on your collector set and clicking the play icon.
  8. Once the trace is recorded, you can then open up the logs and view them in Windows Event Viewer by clicking on "Open Saved Log" and pointing to your newly created BCS Event trace file.


If found this particularly useful when troubleshooting BCS Offline Caching issues on Outlook clients.

The event trace indicated that an old version of my BCS models and connections was being used to the Duet/SAP system.

To resolve my problem, I had to remove all instances of the BCS lists in Outlook by uninstalling Data Lists and Solutions that refer to that one SharePoint 2010 External Content Type. This resolved my caching problems and it stopped giving me "Access Denied" Exceptions when Synching with Outlook 2010.
 
DDK

Friday, 22 July 2011

SharePoint 2010 Business Connectivity Services (BCS) Local Cache Data

When you take a SharePoint 2010 list offline (e.g. into SharePoint Workspace or Outlook), BCS entities are created in your local drive. These are often supported by ClickOnce Office Solutions deployed via Visual Studio Tools for Office 4.0 (VSTO). For reference, the following locations are used for BCS data and ClickOnce installations:

BCS Client Cache Data files are located in a hidden folder at:
%USERPROFILE%\AppData\Local\Microsoft\BCS

Supporting ClickOnce Applications are located at:
%USERPROFILE%\AppData\Local\Apps

DDK