How to disable SharePoint People Picker suggestion cache

Recently, I run across strange issue with People Picker in SharePoint 2013. Our customer who uses Windows classic mode authentication, reported, that after saving the item by clicking on Save in standard NewForm or EditForm, the value specified in User Field is different from the value that they provided in People Picker.

They filled out the user field with the value X, and it was saved with different user Y.

Symptoms:

After saving the standard item form, the item is saved with different user than previously specified in the form.

Applies to:

SharePoint 2013 – Classic Windows Authenticaton mode

Explanation:

By default users resolved through PeoplePicker are stored in LocalStorage (window.localStorage), so next time it doesn’t have to load user details from SharePoint.
However in Windows classic mode it stores SPUserId which is then used when saving value to SPUserField. This causes the problem when the same user reside in 2 site collections and has different IDs.
So basically it works only in the first site collection where the user was resolved. In any other site collections it resolves fine, but SharePoint then uses SPUserId from the local storage, which is the ID from the first collections and completely different value is stored in the field.

Solution:

There is couple solutions for this:

  1. Switch to Claims based authentication
  2. Disable local storage for ClientPeoplePicker (and be aware of the consequences) by setting roperty UseLocalSuggestionCache on the ClientPeoplePicker. This can be done by inserting following javascript into masterpage (directly if you have custom masterpage or through delegate control)

    Please consider the consequences. Local Storage is there for a reason. Evaluate in your farm if disabling local storage for client people picker does not considerably degrade the performance.
  3. There is a way how to just clear the cache used for People Picker (instead of completely disabling it)

 

SSRS 2014 Add-In installation in SharePoint 2013

Issue

Installing SQL Server 2014 Reporting Services Add-In to SharePoint 2013 fails and log contains following:

This error occurs either by installing from SQL Server 2014 installation or from rsSharepoint.msi, which is  downloadable from MSDN.

Cause

Installation package failed to change web.config file of one or more Sharepoint web applications.

Resolution

Use two step installation to troubleshoot the issues: (MSDN article here)

and then:

The command will try to register Reporting Service configuration in web.config files. If you have more than one web application, it’s necessary to find which web application causes the problem. I managed it by looking for:

This section (among other elements) is added to web.config when installation of SSRS completes succesfully. If it missing in the web application’s web.config , then there is probably something, which bothers the installation (even though the web application runs without any problem in the browser).

In my case it was a comment between two elements (which doesn’t bother SharePoint but bothers SSRS installation).

 

Upload Multiple Documents is disabled in SharePoint 2010

Description

Drag&Drop feature for uploading multiple files does not work in Internet Explorer in SharePoint 2010 environment. For some users this feature is disabled/hidden. However, it’s avalaible for other users in the company.

Things to check

  • It works only in IE
  • Internet Security is too high (doesn’t allow to run ActiveX controls)
  • Microsoft Office is not installed on the computer

There is a KB from Microsoft that sums it up.

However, I experienced one other issue. These computers had one thing in common, they all had Office suite reinstalled (from 2003 to 2010). As a consequence, in Internet Explorer there was an old version of ActiveX control library (STSUpld UploadCtl) registered. You can check it by:

  1. Open Internet Explorer
  2. Tools | Manage add-ons
  3. From drop down list choose All add-ons
  4. Find STSUpld.UploadCtl | right click on in and choose More information
  5. Compare Version and Folder.

Version should start with 14.* (or 15.* in case of Office 2013). Folder path should head to Office14 or Office15 folder.

sp-activex-Detail

Solution
It’s necessary to fix old reference and replace it with current one (based on the version of Office installed).

It can be done by:

  • Completely u​ninstalling old version of Office and reinstalling current one
  • If it’s enabled, then in window More Information click on Remove
  • Using RegSvr32 command to re-register DLL StsUpld.dll

How to force browsers to get latest script files on ASP.NET pages in automated way

I was looking for a nice way how to force browsers to refresh its cached version of files and reload script files after the change occured.

Usually we link JS files or CSS files like this:

If you want to force refresh, you can amend parameters to url, ie.

Well, this is manual way, so how do it in automated way, so I do not have to care about it? There is several ways how to do it, I will just mention one, which is simple and reliable and you do not have to remember to increase anything upon deployment. (it’s not my idea, thanks to Adam Tegen and his answer in stackoverflow). I took the liberty to change it so it’s possible to use in ASP.NET webforms as well.

 

In ASP.NET page link the file as:

 

Failed to deploy SharePoint app to Office 365

During a development of my auto-hosted app, deploying to SharePoint Online started to fail in very undeterministic way.

1. When deploying through Visual Studio yout might receive:

  • Cannot register Services/*.svc on Windows Azure Service Bus: Unable to connect to the remote server
  • One or more services were unregistered from the Windows Azure Service Bus.

2. When deploying to AppCatalog

  • upload of app package to appCatalog site would fail. Usually at repeated attempt it would succeed.
  • If deployed succesfully, remote event receivers or workflow would not be triggered (application web wasn’t probably deployed, but there was no error message)

Reason

In my web project I used additional libraries (such as Exchange EWS libraries) which weren’t included in the package. These libraries weren’t in Visual Studio set to Copy Local = true.

Solution

Make sure to set all yours references to be included in the package. sp_app_externalLibs

Automatic upload of app content to SharePoint Online

This is a more of a tip, what I find very useful in development of SharePoint Apps in Visual Studio and I wish someone told me at the beginning, when I started.

When developing a SharePoint-hosted app, debug mode in Visual Studio offers great feature, which enables you to change content of your aspx page, js files, css styles and after saving, the content is automatically uploaded to the SharePoint environment, so you can test it immediately in the browser and still stay in debug mode. So there is no need for small changes to redeploy it.

Following picture shows, that after saving in the debug mode, the content was succesfully uploaded to SharePoint Online.

sp_app_visualStudio_upload

Changes of other file types, ie. SharePoint definition files (elements.xml, features, etc.) are not propagated, for this you need to redeploy it again.

Typescript issue

What I am still trying to figure out (and hoping guys watching stackoverflow will help me) is how to make it work with other file types, for example Typescript files.

After saving Typescript file, JS file is automatically re-generated , but this JS file and TS file are not uploaded to the server. It can be partially solved by manually changing content in JS file to trigger automatic upload to SharePoint, however I couldn’t find a way to upload TS file.

Access denied error while authenticating user in SharePoint 2010

After moving user account to different organizational unit in Active Directory, in some cases this user might then receive Internal server error 500, when accessing SharePoint 2010.

Environment:

  • SharePoint Server 2010 – Standard
  • Intranet – Classic windows authentication (NTLM), no anonymous
  • SQL 2005 (!!!)

Log in dialog keeps pop in for the user, even though he is providing correct credentials (checked for sure).

When it happens

It happened, only when moving user to different organizational unit in Active Directory.

After some digging, we discovered, that this error happens only for users, that have this record in SharePoint Content database, table UserInfo, column tp_Token is set to 0x.

tp_token_0x_error

 

Reason 

After a consultation with Microsoft, it’s caused by bug, that occurs only if using SQL 2005 database. It doesn’t happen in later versions. There is no KB for it (well not the public one).

Solution

  1. delete a user and recreate the account (using the powershell)
  2. If you really don’t care about Microsoft Support, you can change the value in database to null. (it works, but for obvious reasons don’t do it)

Hope it helps to lighten it up a little.

ESPC14 and my summary

European SharePoint Conference 2014  (#espc14) held in Barcelona was my first to attend and it was just amazing. I am grateful that I could be there and to be a part of the SharePoint community. It’s wonderful experience and chance to hear and see upfront what’s going on in SharePoint and what are the Microsoft plans.

This article tended to be only for my collegues and friends, but then I realized it’s general enough and it could be useful for others as well. I hope that this will enrich others and will give others some ideas what was presented and what I find interesting.

ESPC was happening 2 month after the main SharePoint conference in Las Vegas. European event is smaller, which I guess is not a bad thing. Mostly I regretted that I cannot split myself to be able to attend multiple presentation (I cannot imagine what I would feel in SPC).

For Czech readers, there are nice articles from Jana Babáčková

If you are interested in some numbers and comparison:

  • number of attendees: 10000 (SPC), 1400 (ESPC)
  • countries attendees were from: 85 (SPC), 45 (ESPC)
  • number of presentations: 230+ (SPC), 100 (ESPC)

(these are not official and exact numbers)

Well, now to the presentations. This list is what I found most interesting for developers. Also, it’s a list I would easily recommend to others to read through or watch. I was inspired by similar post by Jeremy Thake about SPC, which you can find here.

If it exists, I attach link to live video to SPC conference with same/similar presentation (SPC presentations were recorded, ESPC’s nope).

1. Keynote: Now We Know, Now We Don’t (Dan Holme)

  • video from SPC14 here.

2. Understanding the Five Layers of SharePoint Security (Michael Noel)

3. Optimizing SQL Server for Speedy SharePoint (Sahil Malik)

4. Think You Can Hack SharePoint? (Liam Cleary)

5. The Ultimate SharePoint Infrastructure Best Practices Session (Michael Noel)

6. ALM for Developing Apps and Sandboxed Solutions Targeting Office 365 (Jeremy Thake)

7. Using JavaScript Templates To Customise the SharePoint 2013 User Interface (Chris O’Brien)

8. Transitioning Your SharePoint Solution Model Skills to the New SharePoint App Model (Jeremy Thake)