SharePoint Dragons

Nikander & Margriet on SharePoint

Disable ASP.NET button after click

The combination of the properties OnClientClick and UseSubmitBehavior prevent a button from being clicked twice before completed.

The following makes sure the button can’t be clicked twice:


But, this also means the ASP.NET click event won’t happen!!! In order to do so you need to set the following:


Setting this property to true bypasses the client browser’s submit mechanism in favor of the ASP.NET postback mechanism. Setting this leads to the insertion of some client-side script to the page th post the form to the server. Here’s a complete example that can be included in an .aspx page:

My Tasks web part outside of MySites, but pointing to the personal site task list?

We had a requirement to place a My Tasks web part outside of SharePoint personal sites, in a regular site collection, pointing to the Tasks list of a personal site. There were two interesting blog posts surrounding this topic. The first one, , mentions that it’s possible to use the My Tasks web part outside of My Sites by enabling the hidden My Tasks Dashboards feature on a specific web, which can be done like this:

Enable-SPFeature 89D1184C-8191-4303-A430-7A24291531C9 -url [http://[url_web]http://[url_web]

Doing that actually adds the My Tasks web part to the web part gallery, but it is not enough. The next resource has more to say about that: The approach proposed here involves exporting the My Tasks web part, then import it in the other site collection and copy a couple of pages needed by this web part to another site collection. The presence of these pages is an absolute necessity to get the My Tasks web part. After doing some experimenting, most of the tabs of the My Tasks web part indeed work correctly (namely “Active”, “Completed”, and “Recently Added”) after following this approach, but the “Important and Upcoming” tab remains a problem. That is, if you want it to refer to the Personal Site task list.

This problem, that lies in the TimeLine web part, is quite definitive. As it turns out, the web part calls a method named IsAddressValid() of the TimelineDataSourceToolPart web part (which is part of the Microsoft.SharePoint.WebPartPages namespace of the Microsoft.SharePoint assembly). This method checks that the data source points to a URL that is part of the same site collection hosting the My Tasks web part. So, site collection X can never have a working “Important and Upcoming” tab in a My Tasks web part that points to the Personal Site Tasks list.

Diff Checker

Nice web site that can check differences between texts: in case you do have internet access but don’t have access to a more advanced comparison tool.

Imagine Cup

Check out Margriet’s latest TechNet Wiki blog post about the Imagine Cup:

Are Draft versions of items and documents indexed in SharePoint 2013?

This can be tested for both lists and document libraries, and the answer depends on various list settings (a term we use in a generic way that also includes document library settings). Possible list settings are:
– Content approval setting: With or without content approval
– Draft item security: Any user who can read items, Only users who can approve items, or Any user who can approve items (and the author of the item).

Searching using the credentials of the author results in items in lists as well as document libraries that only require Read permissions (option “Any user who can read items”). All other Draft versions in lists and libraries with different settings are not included in search results. For instance, a document in Draft version in a library that has the following condition: [go to document library > Library > Library Settings > Versioning settings > Draft Item Security > Only users who can edit items] is NOT returned.

Searching under the context of a user that only has READ permissions yields the exact same search results.

Investigating the crawl log shows that the items that are not returned aren’t even indexed.

Microsoft Fakes: building a shim for the SharePoint 2013 SSOM

We were building a mail class used by SharePoint solutions that leverages the SmtpClient class because SPUtility.SendEmail() is too limited in some ways:

  1. It doesn’t send attachments.
  2. It contains a max of 2048 chars per line, although this can be circumvented by adding line breaks (‘\n’).

More about those limitations over here:

However, we did want to use the SSOM to determine the SMTP server that should send the e-mail messages for us. We could do it like so:

System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(objWeb.Site.WebApplication.OutboundMailServiceInstance.Server.Address);

But in this case, we went for this solution:


This resulted in the following method implementation in our custom SharePoint library is a class called Manager:

public string GetSmtpServer()
return Microsoft.SharePoint.Administration.SPAdministrationWebApplication.Local.OutboundMailServiceInstance.Server.Address;

Very simple. Then, we decided we needed to add some unit testing. If you have VS.NET Ultimate, you can consider using Microsoft.SharePoint.Emulators. We gave it a spin and weren’t that happy with it. At some point, we had to uninstall the package, switch the project to x86, install the emulator again, and switch back to x64, and more stuff like that. But apparently it can be done, according to: , so don’t let us stop you from checking it out!

Then, we were considering other Mocking frameworks (Typemock Isolator, JustMock, Microsoft Fakes) and decided to go with Fakes because of monetary reasons. We then added a unit test project ( VS.NET 2012 > Add > New Project > Unit Test Project), added a reference to our custom SharePoint libary, right-clicked it and chose Add Fakes Assembly.

If you want to know more about Fakes, check out . Basically, it allows you to replace methods and properties during run time with your own implementation.

Because our custom SharePoint library uses the SPS 2013 SSOM it’s built for 64 bit, which required us to change the unit test project to 64 bit too (right-click unit test project > Properties > Build > Platform target: x64). That is not all, you also need to set the Test processor architecture to 64 bit, like so: VS.NET 2012 > TEST > Test Settings > Default Processor Architecture > X64.

When that is done, the unit test project is able to call the SharePoint custom library and we were able to create a shim for our GetSMTPServer() method., which goes something like this:

public void GetSmtpServerReturnsFakeName()
using (ShimsContext.Create())
MyLib.Fakes.ShimManager.AllInstances.GetSmtpServer = (@this) => { return ”mySMTPServer”; };
Manager man = new Manager();

// returns mySMTPServer
string smtpServer = man.GetSmtpServer();

Smartphone simulators

To test the mobile view functionality in SharePoint 2013, we needed some smartphone emulators. Here’s what we came up with…

This web-based iPhone simulator is quite nice:

For the iPhone, there’s also a commercial product which is easy to use and has a trial version. It can be found at

For the Windows Phone, you need to download the SDK at , which uses Visual Studio (2012) and the presence of Hyper-V. This emulator itself can’t run on a virtual machine (although we’ve seen posts that say VMWare 9 can do it).

For Android, check out

Browser shots

Great URL for browser compatibility testing:

Project Adam

Project Adam is a new deep-learning system modeled after the human brain that has greater image classification accuracy and is 50 times faster than other systems in the industry. Watch this video: You should also take a look at:

SSIS Package In Visual Studio 2012: Designer View suddenly gone

Have you ever experienced that the Designer View of an SSIS package in Visual Studio is suddenly completely empty while all the underlying XML is all gone? It had us puzzled, but it was solved by closing all packages in VS (just click the X’s) and then re-opening the package.

Apparently the UI of SSIS is not all fine and dandy, we found this post to be of interest too: