Tuesday, 30 August 2011

FIX - SharePoint 2010 - Disabled New, Extend and Delete Buttons for Web Applications in Central Administration

My current client (a large NSW Government Department) has a test environment that doesn't have Active Directory and they required Duet Enterprise to be installed. After a basic install of SharePoint 2010 with SP1- in Windows Server 2008 R2, SQL 2008 R2, I was alarmed to find that I couldn't create new web applications via Central Administration. When I hovered over the buttons, it said that this functionality is disabled due to insufficient permissions:


I also couldn't add users to the farm administrators account - I would get an odd exception - "Local administrator privilege is required to update the Farm Administrators' group."

I tried rebooting, uninstalling, reinstalling to no avail - the same problem persisted.
There are many recommended fixes for this problem - most of which didn't work for me:
  1. Run in an alternative browser such as Google Chrome/Firefox - this didn't work for me.
  2. Ensure that the Application Pool account in IIS has the correct database permissions - this wasn't the problem in my situation as the user was a full local administrator and sysadmin on the database
  3. Ensure that you run IE as an administrator - this is already done by the default shortcut to the SharePoint Central Admin (I wasn't opening up SharePoint Central Admin from a seperately instantiated browser - so this also wasn't the problem)
  4. Ensure that UAC is turned off as this somehow interferes with the application of security to those controls. Most references to this indicated that this worked for Windows 7, but there was no reference to this working for Windows Server products.
To my surprise, number 4 was the one that worked for me. To do this (in Windows Server 2008+), you have to go to:
Control Panel - User Accounts - Turn User Account Control On or Off

After the reboot, the controls were suddenly re-enabled. This is not a recommended configuration - but this was purely for demonstration purposes rather than being a production-ready install (we would be using Active Directory for that anyway).

DDK






Friday, 26 August 2011

SQL Server 2008 R2 Master Data Services (MDS) IWorkflowTypeExtender - Implementation and Debugging

SQL 2008 R2 Master Data Services (MDS) has a basic plugin framework which allows you to handle events when business rule workflows are kicked off. You implement your custom plugins by:
1) Creating a class that implements IWorkflowTypeExtender. This is contained in the following assembly:
C:\Program Files\Microsoft SQL Server\Master Data Services\WebApplication\bin\Microsoft.MasterDataServices.Core.dll

2) Build and deploy the file to the bin directory (typically "C:\Program Files\Microsoft SQL Server\Master Data Services\WebApplication\bin") or a subdirectory of it if you use a PrivatePath (discussed below).
3) Modify the "Microsoft.MasterDataServices.Workflow.exe.config" file to point to your new assembly:

<configuration>
  <configsections>
    <section name="loggingConfiguration" requirepermission="true" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <sectiongroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="Microsoft.MasterDataServices.Workflow.Properties.Settings" requirepermission="false" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    </sectiongroup>
  </configsections>


4) Add another section to your config file that indicates what workflows to listen to (based on the value flag)

<applicationSettings>
    <Microsoft.MasterDataServices.Workflow.Properties.Settings>
      <setting name="ConnectionString" serializeAs="String">
        <value>Server=.;Database=MasterDataServices;Integrated Security=SSPI</value>
      </setting>
      <setting name="WorkflowTypeExtenders" serializeAs="String">
        <value>PAC=CompanyName.MasterDataWorkflow.WorkflowExtender, CompanyName.MasterDataWorkflow;OOB=Microsoft.MasterDataServices.Workflow.WorkflowTypeTest, Microsoft.MasterDataServices.Workflow, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91</value>
      </setting>
    </Microsoft.MasterDataServices.Workflow.Properties.Settings>
  </applicationSettings>
  <appSettings>

The plugin will allow you to obtain information about the calling workflow via the StartWorkflow(string workflowType, System.Xml.XmlElement dataElement) method that must be implemented as part of the interface of IWorkflowTypeExtender. You receive all the business context data via the data element parameter as an Xml snippet.

Once you have deployed this assembly and update the config files, the simplest way to debug inside Visual Studio is to go to your Project Properties, Debug Tab and Set the Startup Program to be
"C:\Program Files\Microsoft SQL Server\Master Data Services\WebApplication\bin\Microsoft.MasterDataServices.Workflow.exe".

After doing that, add a commandline parameter of "-console" which will give you a visual display of workflow plugins that have been loaded into the MDS Workflow Application Domain. It also allows you to print out to the console via Console.WriteLine() to assist with your development and debugging efforts.

Debug Setup

The MDS Workflow Console window:

As a best practice, use a PrivatePath in your Assembly Bindings in your Microsoft.MasterDataServices.Workflow.exe.config file. This will allow fusion to find your custom binaries in a subfolder rather than the binary root. Keeping all custom binaries in subfolders will help you to avoid file naming conflicts or bloating your root MDS workflow bin directory.


The simplest way to see what's going on is to just render the Xml from the workflow handler to the MDS workflow console window via an XmlTextWriter e.g.

public void StartWorkflow(string workflowType, System.Xml.XmlElement dataElement)
        {
            Console.WriteLine("workflow type: {0} ", workflowType);

            var writer = new XmlTextWriter(Console.Out);
            writer.Formatting = Formatting.Indented;
            dataElement.WriteTo(writer);

DDK

Monday, 15 August 2011

Fix for Exception - "Initialization of the data source failed" in TFS 2010 Excel Reports against SSAS 2008 R2

At one of my banking clients, there was an issue with the setup of the TFS Reports in Excel. When opening the Excel reports provided with TFS, it was attempting to connect to the TFS Analysis Services Cube - and generating the following exception:

Initialization of the data source failed.

Check the database server or contact your database administrator. Make sure the external database is available, and then try the operation again. If you see this message again, create a new data source to connect to the database.




Then you get prompted for credentials, and then get a message about reinstallation of drivers.


There are a few red-herrings in the messages provided by Excel - but the underlying problem in our situation was just a permissions one.

To resolve, you just need to give the end user with the problems permissions to access the SSAS database (e.g. by adding them to the TFSDataReaders role in SSAS).  Alternatively, you can add the user as a TFS Administrator in the TFS Administration console (though this is not preferred as it is against the security principle of "least priviledge").

Till next time,
DDK

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

Wednesday, 27 July 2011

Fix for "The service was unable to start because the version of the database does not match the version of the product." in ForeFront Identity Manager Sychronization Service for SharePoint 2010

I had an issue today with the ForeFront Identity Manager Synchronization Service when Synching to Active Directory and SAP in the User Profile Store. It was generating the following exception when I attempted to run a full or incremental User Profile synchronization:
  

"The service was unable to start because the version of the database does not match the version of the product."
 
If you get this problem, you will need to reprovision the User Profile Synchronization Service Application by stopping and restarting it (and reentering the password for your syncrhonization service user). This resolved the issues I was having - and the ForeFront Identity Manager service could then start correctly. The steps to do this are as follows:
 

1.Central Admin>System Settings>Manage Services on Server (select the server where the User Profile Service is running)

2.Stop the User Profile Service

3.Stop the User Profile Synchronization Service (you will be prompted that this will deprovision the service)

4.Once the services have stopped, Start the User Profile Service again

5.Start the User Profile Synchronization Service again (you will be prompted to enter the password for the User Profile Service's svc account) -note1: this service can take a little while to restart; note2: if it does not restart successfully, restart the server and try again (this has worked for me)

6.Once complete, the User Profile Service and User Profile Synchronization service should show as Started, and the 2 corresponding FIM services on the server should be running again.

For Reference:
I've mentioned this in the blog previously, but you can start up the ForeFront Identity Manager UI from the following location:

"%ProgramFiles%\Microsoft Office Servers\14.0\Synchronization Service\UIShell\miisclient.exe"

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

Friday, 15 July 2011

Fix for VSTO ClickOnce application - "Unable to install this application because an application with the same identity is already installed. To install this application, either modify the manifest version for this application or uninstall the preexisting application"

If you receive the following exception even though your VSTO ClickOnce application is already uninstalled:

"Unable to install this application because an application with the same identity is already installed. To install this application, either modify the manifest version for this application or uninstall the preexisting application."


Then you may have issues with your ClickOnce application Cache. You have 2 options for clearing it:

Running the following at a Visual Studio Command Prompt:
mage -cc

OR

Running the following at a command line on any machine with the problem:
rundll32 dfshim CleanOnlineAppCache


See http://vijayvepa.wordpress.com/2011/01/11/unable-to-install-this-application-because-an-application-with-the-same-identity-is-already-installed-to-install-this-application-either-modify-the-manifest-version-for-this-application-or-uninstall/ for more details.

DDK