Archive

Archive for the ‘SharePoint 2013’ Category

Normal user cannot save SharePoint taxonomy fields

Hi Folks

Nice simple one this.

Users could edit a list and select taxonomy terms but when the saved the item the taxonomy terms were not saved.

Simple answer the hidden taxonomy list, which maintains the item to taxonomy term mappings, had its permissions set so that normal users could not write to it.

Then users can save taxonomy terms to managed metadata fields.

Cheers

Sebastian

Categories: 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

FatalError: Backup failed for Object Crawl-1

Hi Folks

Nasty one this happened when using Backup-SPFarm on a client’s production site.

We capture the services every week with the following command:

Backup-SPFarm -Directory:”\\SERVER\\Share\Services” -Item:”Farm\Shared Services” -BackupMethod:Full

This week it failed with:

FatalError: Backup failed for Object Crawl-1

After much digging it turned out that the Share’s permissions had been tightened too far.  Crawl-0 succeeded but its on the box that runs the backup.  Crawl-1 is on another box.

I reinstated the share’s permission so the following had Full Control on it:

  • Account that executes the backup.
  • The farm account.
  • The SQL Server account the service databases run under.
  • The Search Service account.

Hope this help

Sebastian

How to Brand SharePoint 2013 My Sites: Part 3: Applying Site Master Pages

Hi There

So far this series consists of the following posts:

We now have a solution that shows links to all of the layouts pages we need to manipulate design packages via the Site Settings page except for Master Pages.

This post shows you how to create a page similar to the OOTB SharePoint Site Master Page Settings that will work in a SharePoint My Site.

Adding the link is simple enough, it is defined in the Publishing feature which is not activated in My Sites, see part 2 for an explanation of probably why not.  The Id of the feature is “AreaChromeSettings”.

Easy enough to add the link back we just copy the definition, change its name and add it to our site scoped feature.  We deploy and activate the feature and the link is displayed.

However if you do this you’ll just get a blank page.

Digging into this its due to the code behind on the page that is trying to work out which master pages are appropriate and using various parts of publishing to do so.  If you check in the ULS logs you’ll see it raises a the following error:

One or more field types are not installed properly. Go to the list settings page to delete these fields.<nativehr>0x81020014</nativehr><nativestack></nativestack>, StackTrace:

at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()

Chasing it through via .NET Reflector (or ILSpy) shows that the code behind uses numerous items from the publishing namespace.

Using this page is not an option.  Neither is the “Change the Look” page as it won’t show anything other than those pages with a preview page.  We could create a mysite.preview page and upload it which would allow us to select the master page this way but doing so means that we are really beginning to change the default site.

The best approach is to write your own Set Master Page application page and provide a link in the Site Settings under look and feel based on the existing link in the Publishing feature.

Once done you can set the master page this way and then create your design package as normal.

Next we will move onto how to automatically band a site when it is created.

Cheers

Sebastian

 

How to Brand SharePoint 2013 My Sites: Part 2: Adding Design Packages Links via a Feature

Hi There

So far this series consists of the following posts:

Continuing on the ‘how to brand my sites’ with minimal programming series.  We saw how by typing URLs directly into the browser we could access all of the pages we needed in a my site to create, save and apply a design package, except for setting the master page which we used SharePoint designer to handle.  This wasn’t too surprising as these pages are in the _layouts folder which is available to every site.  However it was a bit painful compared to using the Site Settings page to access them.  In this post we’ll look at how we can create a purely declarative (no code) feature that puts these links back for us.

To do this we need to examine the features that normally place these links on a site; the features that remove them from My Sites and as a result we’ll understand why they aren’t available by default and also why we can safely add them back so long as we are using Standard edition.

There are two features that put the required links on the Site Settings page:

  • SiteSettings, this shows the themes links.
  • HtmlDesign, this shows the design settings links.

HtmlDesign is a hidden feature which is part of Publishing which is NOT part of SharePoint Foundation.  My Sites are part of SharePoint Foundation however so these do not get activated by default.  You can activate them but they have other dependencies on Publishing features and so unless you make every My Site a publishing site this will fail.  This behaviour appears to be by design.

I haven’t tried it but gut feel is that making your my sites publishing sites may not be a good idea as it provides users with a more complex interface and also there can easily be a lot of my sites.  A five hundred user system might have a hundred publishing content sites and publishing sites use more disk and resource than standard my sites so this would be a significant size increase.  Having said this it might be the way you decide to go but even if you do you’ll still be missing the themes links.

SiteSettings is Farm scoped so it is activated in all sites by default and this places the two themes links onto every page.  However the MySiteUnifiedNavigation feature then hides these, presumably as without the HtmlDesign links they have little use.

So how do we get these links to show?

Simple we create a new Site scoped feature, copy the relevant CustomAction tags from the features and change the name of them so they will not clash.  Then we activate it where we need it and we will have the links, except for the set master page one.  We can then use the process in part one of this guide but now navigating via Site Settings to create a design package on our development farm.  We can then copy this package to our production farm and either deploy and activate our feature so we can import the design package or, as we tend to do, just use PowerShell to import the design package so that in production things are much more like OOTB SharePoint.

However we have not finished yet there are still a few more tasks to do.

  • Give access to the set master page functionality without requiring SharePoint designer.
  • Handle the ‘multiple site collection / site’ nature of my sites.
  • Brand the sites automatically on creation.

More on this tomorrow.

Cheers

Sebastian

 

How to Brand SharePoint 2013 My Sites: Part 1: Using Design Packages

 

Hi Folks

So far this series consists of the following posts:

I’ve been asked to brand a SharePoint 2013 On-Premise Farm for a client, a London Law Firm.

Easy enough but there are certain restrictions. The last company that did this produced a very code heavy solution that is now getting difficult to maintain as the company has been bought twice and the internal staff on the project have all left.

Once bitten twice shy so custom code is to be kept to an absolute minimum.

The branding of the Content Sites is easy enough I worked with a designer and we mocked it up using a development farm, saved it to a design package and then used PowerShell to import it to the pilot site.

Then the next sites up where the My Sites. They don’t have the site settings page links to let you get at anything other than the Composed Looks link.

However all of those pages live in the LAYOUTS folder which is available on all sites so we typed the URLs in and off we went.

The mechanism is as you would expect.

  1. Go to Web Designer Galleries > Themes (use http://mysites.sharepoint.local/_catalogs/theme/Forms/AllItems.aspx) and upload spcolor and spfont files.
  2. Go to Web Designer Galleries > Master pages and page layouts (use http://mysites.sharepoint.local/_catalogs/masterpage/Forms/AllItems.aspx) and upload master files.
  3. Go to Web Designer Galleries > Composed Looks (use http://mysites.sharepoint.local/_catalogs/design/AllItems.aspx) and create a new composed look.
  4. Go to Look and Feel > Change the look (use http://mysites.sharepoint.local/_layouts/15/designgallery.aspx) and select your look.
  5. Go to Look and Feel > Design Manager (use http://mysites.sharepoint.local/_layouts/15/DesignWelcomePage.aspx) and export your design package.
  6. OR Go to Create Design Package (use http://mysites.sharepoint.local/_layouts/15/DesignPackageExport.aspx) and export your design package.
  7. Go to Look and Feel > Import Design Package (use http://mysites.sharepoint.local/_layouts/15/DesignPackageInstall.aspx) and export your design package.

As you can copy the design package between farms you can use step 7 to move your design around.

Things to note:

  1. You can create a link to the Look and Feel > Master page (use http://mysites.sharepoint.local/_layouts/15/ChangeSiteMasterPage.aspx) but it will just display a blank page.  However SharePoint Designer works just fine.
  2. MySites have three components each of which have to have the design package imported.
    1. My Sites Host Collection, the root site typically one per farm, uses the mysite15.master.
    2. My Site, one per user, uses the mysite15.master.
    3. My Blog, one per user, uses the seattle.master.
  3. MySites component sites all have different WebTemplate.
    1. My Sites Host Collection, SPSPORTAL#0.
    2. My Site, SPSPERS#2.
    3. My Blog, one per user, BLOG#0.

Tests show that this works perfectly, exactly as you would expect however cutting and pasting all those URLs is not fun.

The next post in this series will explain how a small declarative feature can make this much easier.

Cheers

Sebastian

 

Avoiding SharePoint Magic Numbers in Unit Testing

Unit testing really is good. No surprise to those who do it but recently we had a test go red when changing how we configure Enhanced Records Manager, see
Appropriate use of AppInstalled for a Provider Hosted SharePoint App for more details.

Not a problem we have broken something lets fix it.

It turns out that every properties metadata was being added twice to our configuration database.  Simple.  We had inadvertently called the ImportProperties method twice.  So all we have to do is remove the wrong call and we are away.  Hold on isn’t import properties supposed to update if the same property is imported twice not add.  Lets dig further.

So when we unit test we don’t use SharePoint, its too ‘heavy’, but we have abstracted it in the design to an Interface called the RecordRepository Interface which has ‘generic’ methods, such as GetProperties which returns all the properties the Records Management system.  This gives us two great benefits:

  1. We can replace it for unit testing by a lightweight RecordsRepository currently a pure in memory one.
  2. We can use Records Repositories other than SharePoint by ‘merely’ replacing the Records Repository as it only deals with access, not logic.

The ImportProperties unit tests weren’t failing so the actual logic was okay, well we all know GIGO (Garbage In, Garbage Out) so if the output is wrong but the logic is right it must be the input.  And Lo and behold so it was.  Our Unit test Records Repository generates a defined set of properties using Guids as their unique identifiers.  Good.  Problem was they were generated each time the GetProperties method was called so if you called it twice you get two sets of properties identical in all but identifier.

A long preamble but it got me thinking.  Why hadn’t we just used the known identifiers for the SharePoint built in fields?  Title is always {fa564e0f-0c70-4ab9-b863-0177e6ddd247}.  We didn’t so why?  Ah yes go back to point 2 the design of ERM is that it is repository agnostic.  If we had just used the ‘magic’ value when we changed the actual Records Repository we could have been in the position where our unit tests passed fine but it failed in practice because we had been lazy and also used the magic value somewhere in the business logic.

So we generated Guids just for our Unit test Records Repository as fixed Guids and that sorted that.

Cheers

Sebastian