Moved

This blog is no longer maintained. All the content has been moved here: http://byteloom.marek-mierzwa.com

Tuesday, 2 October 2012

SharePoint Taxonomies - Commiting large amount of data to the MMD service

Once again about the SharePoint 2010 taxonomy service.

As I wrote in my previous posts, loading data into MMD service automatically can be quite a challenge. First, you must remember about illegal characters in terms labels. Second, you must trace duplicates across sibling nodes in taxonomy trees. And this could not be the end of your problems especially if you plan to load some more data at one time.

Friday, 28 September 2012

SharePoint Taxonomies - Struggling with dupplicated default labels

If you have ever had to load large number of data into SharePoint MMD service or build taxonomies automatically you have likely encountered the following problem:

Microsoft.SharePoint.Taxonomy.TermStoreOperationException: There is already a term with the same default label and parent term.

Thursday, 20 September 2012

SharePoint Taxonomies - Labels with forbiden characters

Recently, when I was working on mechanism of automatic synchronization of tree structures provided by web service to SharePoint taxonomies, I came across an error like this:

The value '(<= 0320-775, 0550-5/7)' is invalid. It probably contains invalid characters or is too long.
Parameter name: name
with the following stacktrace fragment:
at Microsoft.SharePoint.Taxonomy.Internal.CommonValidator.ValidateName(String name, String parameterName)
at Microsoft.SharePoint.Taxonomy.TermSetItem.CreateTerm(String name, Int32 lcid, Guid newTermId)
...

Tuesday, 3 July 2012

Custom XmlResolver for embeded DTD

Writing a component for parsing XML files with XMLSerializer I had to provide DTD validation (DTD file was already created long time ago so there was no sense for creating XSD schema). The component must have been able to work in console application and web app (as a SharePoint timer job) so there was no chance to guarantee the same paths for DTD file (which was always specified in doctype directive in processed files). In such situation I've decided to deliver the DTD file as embedded resource in component assembly.

Friday, 6 April 2012

SharePoint 2010 Batch Edit

For the years I have developed .Net projects I've found many useful solutions on CodePlex repository. Some of them are only drafts of ideas but there are also many products that are ready to use on production environments. SharePoint 2010 Batch Edit which worked with recently is one of this from the second category.

As the name suggests, SharePoint 2010 Batch Edit fills the gap in mass updates functionality in SharePoint 2010. In OOB SP2010 you can select one or more items on list view and perform such operations as check-in, check-out, delete an so on, but there is no tool that would allow to update items data for more than one item at once. Of course you can always write your own application page and display it in dialog box but why you should do this if someone already has done it :-)

Tuesday, 27 March 2012

"You cannot select more than 100 items at once" in SharePoint 2010

Looking for some solution for batch items update I've run into the following problem: when I clicked a checkbox in top right corner of the list (acually a document library) "All Items" view, the browser displayed an error:  "You cannot select more than 100 items at once."


The problem was discussed on the TechNet forum (Selecting more than 100 files in Document Library) and the limit of maximum 100 items per one batch update (like check-in, delete etc.) is described on MSDN:
Limit: Bulk operations
Maximum value: 100 items per bulk operation
Limit type: Boundary
Notes: The user interface allows a maximum of 100 items to be selected for bulk operations.
What is interesting and what was not mentioned in TechNet topic, the limit is controlled on client side by a script, what I will show.

Wednesday, 21 March 2012

Ingo Rammer - Hardcore .NET Production Debugging

Have you ever had a problem with a user complaining on and on that when he clicks some button in your application his computer hangs but it works fine on any other machine where you have tested it? The web service is consuming all the available memory in completely indeterministic way? Or maybe your web application is magically crashing on production machine when it works in the same usage scenario on development and test environment? If not, you are probably in about 1% of the most luckiest developers in the world (or you are not the developer).

Last year I attended in Norwegian Developers Conference 2011 in Oslo where among many other great presentations I've watched the one presented by Ingo Rammer - "Hardcore .NET Production Debugging".

WebPagetest - distributed web profiler

There are many popular tools for web performance profiling/debugging these days. From my personal tool set I could mention Firebug, IE Developers Toolbar (integrated with IE from version > 8) or Fiddler. The common problem with those tools is that they are installed and run locally on developers machine. Sometimes, for example when behaviour of the web app depends on loading all elements in the specific order or time, it is important to determine if those factors vary in different geographical locations. The download speed for China and Germany could be very different. If you face with this kind of problems I could recommend you a great distributed web performance profiler - WebPageTest.

Thursday, 8 March 2012

BLOB externalization for SharePoint - Metalogix StoragePoint

I'm working in service that builds and maintains a big document management system. Since SharePoint itself is not the best option for storing large amount of files (which can be also quite large) and serving them (performance, content DB size limitations etc.) I was evaluating some options for content externalization. I will not get into much details about the reasons for using such solutions because there are many well written articles about this on the Net (like "SharePoint 2010: Storing Documents on the File System with Remote Blob Storage" by Damon Armstrong). I will focus on one - Metalogix StoragePoint.

Tuesday, 6 March 2012

Replace attachment in document library without changing version number

Lately I was looking for some example on how to replace the attachment in document library (SP2010) without changing the version number but without any results. If you've faced the same problem here is the solution:

Friday, 20 January 2012

Custom upload form for document library in SharePoint 2010 - programmatic approach

As I wrote previously the one of my recent projects was to create a new upload page for specific Document Library (based on custom list template) that will use Telerik Upload component (Silverlight) and will entirely replace OOB upload.aspx page. Looking for some suggestions how to do this I found few solutions but none of them met my criteria:
  1. Using SharePoint Designer for customizing default upload page - I'm not sure if this could apply to document library; I also rejected this option from start as non-programmatic approach because of problems in future development and maintenance
  2. New document template redirection trick - looks simple but this wasn't enough elegant solution for me (I know - who cares, it's SharePoint after all... ;-)
  3. Creating a custom action in ribbon and hiding the old one with javascript - the first part looks quite nice but the second is another hack; also, "Add new document" link at the bottom of default document library view still points to the standard /_layouts/Upload.aspx page...
  4. Creating a custom action in ribbon with custom rendering template for ribbon - very nice solution when you want to change upload pages for all lists on farm, but this is not applicable in my case; still "Add new document" link at the bottom remains
There were also other approaches like changing all related links with jQuery on client side but I would prefer some simple, elegant and server side solution that will not cause any problems on migration to the next version of SharePoint.

Wednesday, 18 January 2012

Error: “Value cannot be null. Parameter name: formType” retrieving default view page of document library

Few days ago I faced with the problem of linking to default view page of custom document library (for purposes of redirection with Source parameter after uploading new document and filling it's meta data form).
At first I tried using SPList.Forms collection indexed with PAGETYPE enumeration as I found in article "How To Always Link to the Right Application Pages". But every time I was trying to get the default view object this way:

var defaltViewUrl = documentLibrary.Forms[PAGETYPE.PAGE_DEFAULTVIEW].Url;


I was getting the following exception:

ArgumentNullException: "Value cannot be null. Parameter name: formType"
Fortunately this was working fine:

var defaultViewUrl = string.Format("{0}/{1}", documentLibrary.ParentWeb.Url, documentLibrary.DefaultView.Url);


I've checked that SPList.Forms collection returns valid forms/pages objects only for these three values:
  • PAGETYPE.PAGE_DISPLAYFORM
  • PAGETYPE.PAGE_EDITFORM and 
  • PAGETYPE.PAGE_NEWFORM
For every other it throws arg null exception as described above. This looks definitely like a bad design in Sharepoint API (one of many...) - the collection should be indexed with other enum that contain valid set of values.

You can find some more detailed info about the reason of this strange behavior on the short stackoverflow thread started by my question. How Stefan figured out that error is caused by enum to string conversion? I guess this mystery was revealed with ILSpy or some similar tool ;-)

Hello world!

Welcome on my new blog (and also the first one).
In few days I plan to picture some of my first experiences with development in SharePoint 2010. They are related with my current project - custom upload form with Telerik upload control (Silverlight) that will entirely replace the standard OOB upload mechanism for custom document libraries.