Archive

Posts Tagged ‘SharePoint 2013’

An internal database error occurred in the Business Data Connectivity Shared Service. SQL Error Number : 229. Occurs after Applying Sharepoint 2013 Service Pack 1 or a Cumultaive Update

We just had a customer report that their user profiles weren’t updating with information from their HR system.

Checking everything was alright I went to Central Admin and the BCS service failed with a standard “An error has occurred and a correlation id”.  Checking the event logs (ULS) via the ULSViewer I got the following error message:

Application error when access /_admin/BDC/ViewBDCApplication.aspx, Error=An internal database error occurred in the Business Data Connectivity Shared Service. SQL Error Number : 229. Please contact your administrator.

at Microsoft.SharePoint.ApplicationPages.ViewBDCApplication.OnLoad(EventArgs args)

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Not a lot on the Internet about this but some people do mention SQL Permissions.  We had just applied the December 2014 CU for SharePoint and checking the FIM logs that’s when the problem occurred.

So I checked the permissions on the BCS Database.

The Account the BCS Service runs under was listed but with no database role memberships at all.

I gave it SPDataAccess and it all sprang back into life.

We have added this as something to check after each CU now.

Cheers

Sebastian

Using Themed StyleSheets in your SharePoint Web Parts

Hi Folks

A simple little trick here.  We have developed a nice tabbing web part (which is NOT a jQuery wrapper which shows and hides but a ‘proper’ we only load what you need tabbing system) and as part of it we wanted to use the Search Navigation Web Parts theming.

We did this for consistency so that out of the box the experience with our web part is identical to the only other tabbed interface in SharePoint.

We also wanted to respect any theming that was in place rather than force our own onto the part.

Now its very easy to reference a SharePoint themed style sheet in a web part the trick is simply in OnLoad to use the CssRegistration class as follows:

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
CssRegistration.Register(“Themable/searchv15.css”);
}

Now the style sheet will be loaded and you can use its styles.  In addition if you are using theming the themed version will be loaded for you so your colour and font choices are respected and finally if anything else has requested the same style sheet it will only be loaded once.

Cheers

Sebastian

 

Sharepoint Restoration Blues: There was an error in accessing the Catalog. Error: System.InvalidOperationException: There is no default Business Data Connectivity Service Proxy available for the given SPServiceContext

Hi Folks

After a Disaster Recovery to a stand by farm I got this error when attempting to add a User Profile Synchronization Connection to a BCS External Source I got the following displayed in the External Content Type Picker:

There is no default Business Data Connectivity Service Proxy available for the given SPServiceContext.

Head scratching ensued until I checked:

  • Central Administration
  • Application Management
  • Web Application
  • Selected “SharePoint Central Administration v4” and clicked on Service Connections.

Configure Service Application Associations

  • Select the missing service applications.
  • Select OK.

Bish bosh jobs a good’un.

Cheers

Sebastian

SharePoint Menus disappear in IE11 (and Site Actions give “An error has occurred with data fetch. Please refresh the page and retry.”)

Hi Folks

An annoying one this some users when they try to edit a SharePoint item report that the ellipses (…) don’t work correctly.  These users also get the following error message when they click on the site actions (cogwheel) button.

An error has occurred with data fetch. Please refresh the page and retry.

After a few experiments it turned out to be related to the user and not the machine.  So it’s a user profile issue.

Further testing showed that if you use the F12 developer tools the emulation options are all blank and the dropdowns for them are also blank.

It’s a user profile problem.

Specifically one of the following registry keys under one of these keys points to a folder that the user does not have access to.

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Extensible Cache
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\LowCache\Extensible Cache

It was a CachePath key and it had the following value:

  • %USERPROFILE%\AppData\Local\Microsoft\Windows\History\History.IE5\MSHist012014110320141110

Deleting this key resolves the issue.

Lovely user can now edit happily.

Next morning she rings up again, the problem is back.

Check the key and its back too.  Delete it things start working.

However we have a mystery what put it back?

  • Policy, no we checked.
  • Roaming Profile, no they don’t use those.
  • AppSense,  no it does touch these keys.
  • AppSense, yes it does restore temporary profiles from a network drive and those (it turned out) include these keys.

We deleted the users temp profile, she rebooted and the problem did not reoccur.

So why did AppSense not write back the changes to the registry when she logged off put did restore the old ones when she logged on?

That is still a mystery.

Cheers

Sebastian

Pulling the table cloth from under the enumeration glasses

Hi Folks

Ever had a need to do something to every item in a collection that would change the collection?  I don’t know lets say removing all SharePoint Site Collections under a managed path.

Now we all know that you can enumerate a collection and then loop through acting on each element but if you change the element in a way that’s meaningful to the enumeration, say adding or removing an element or changing its identifier then, quite rightly, the enumeration throws an error.

Now this is correct when developing a generic solution as it prevents a number of context specific bugs, i.e. I remove all the elements but another process adds one whilst I’m doing it so at the end I think my collection is empty but actually its not.  If this is important to you then this technique is not correct, I’d suggest a while enumeration is not empty remove loop instead.

However often when acting as an administrator such concerns don’t apply, for example I’m the only one acting on the elements of the enumeration or I can always run it twice if needed. In this case there is a well known solution we enumerate the collection and store the result as a variable of a suitable type, probably a list or array, and then act on the variable by enumerating it. As we are modifying the ‘copy’ of the references and not the elements themselves we can happily add, edit and remove them because we are affecting the original elements and not the references we are now enumerating.

So how do we do this in PowerShell?

$Collection = Get-SPSite -Limit:All

This will get us a reference to all the site collections we can now act on, be careful though this will remove all the site collections in your farm.  For safety I’ve put the somewhat confusing double negative confirm flag on so at least you will be prompted before a site is deleted.  If you want it to not prompt you use -Confirm:$false, i.e. do not ask me for confirmation.

$Collection |% { Remove-SPSite -Identity:$_ -Confirm:$true }

Lovely in just two lines we have acted on every site.  We can reduce it to a single line but not as we would expect.

Get-SPSite -Limit:All |% { Remove-SPSite -Identity:$_ -Confirm:$true }

Instead we have to cast our results to an array to force the enumeration to complete before passing it to our script block.

@(Get-SPSite -Limit:All) |% { Remove-SPSite -Identity:$_ -Confirm:$true }

Bish bosh, job’s a good’un!

Cheers

Sebastian

Adding the org chart back into a SharePoint 2013 My Site

One thing everyone loved about the SharePoint 2010 my sites was the Silverlight Organisation chart.

It seems to have been dropped from SharePoint 2013, my guess as Silverlight is no longer flavour of the month.

However its still there on the \organizationview.aspx page in the My Site Host Collection Site.

All we need to do to bring it back is modify the quick navigation and add a link to it and hey presto!

We can do this via the GUI or we can use PowerShell to do this.

Using the GUI

Log onto the my site root site as a site collection administrator.

Select the ‘Gear Wheel’

Select ‘Site Settings’.

Under ‘Look and Feel’ select ‘Quick Launch’.

Select ‘New Heading’.

New Heading

Set the web address to http://<my site host collection root site URL>/organizationview.aspx’.

Set the description to ‘Organisation Chart’.

Select ‘OK‘.

Using PowerShell

$Web = Get-SPWeb -Identity:http://<my site host collection root site URL>/”

$Navigation = $Web.Navigation.QuickLaunch

$Node = New-Object `

-TypeName:“Microsoft.SharePoint.Navigation.SPNavigationNode” `

-ArgumentList:“Organisation Chart”, http://<my site host collection root site URL>/OrganisationView.aspx”, $true

$Web.Navigation.QuickLaunch.AddAsLast($Node)

Organisation Chart Link

Enjoy

Sebastian