Latest Entries »

In Silverlight 5 (and may be earlier), you would face a real frustrating issue when using ChildWindows…the problem is as soon as you close a ChildWindow the application would freeze. Well, the solution is pretty simple it requires you to copy-paste the following piece of code to your ChildWindow’s class:

protected override void OnClosed(EventArgs e)
   Application.Current.RootVisual.SetValue(IsEnabledProperty, true);

Code Source: Silverlight Community

While I am not the guy who found it, but I sure have used it a lot of times and trust me, it does work.

Cheers! 🙂

Since recently my fondness towards the Datasheet view of Sharepoint had increased and today, I thought to finally try it and du-oh, I got an error message slapped right to my face:

The list cannot be displayed in Datasheet view for one or more of the following reasons:

– A datasheet component compatible with Microsoft SharePoint Server is not installed.
– Your Web browser does not support ActiveX controls.
– A component is not properly configured for 32-bit or 64-bit support.

Well, I do use a 64 bit machine but what I didn’t realize until I saw this link that I was also using the 64 bit edition of Office 2010. So, I quickly followed the proposed solution i.e. I downloaded the “2007 Office System Driver: Data Connectivity Components” and installed it on my machine and viola…I was able to enter the Datasheet mode. But, waiting for me over there was another strange error…I was shown a message at the bottom left corner saying “The view is read-only”. I did find a solution to that issue but more on that later


I hope google does deliver it “One day” and then not trash it “Another day”.

Got an error “This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator.” while viewing your Sharepoint List or Library, no worries, it’s just a Lookup Threshold that Sharepoint enforces on a Web application by default. To get rid of this problem, do the following:

  1. Go to the Central Administration.
  2. Under Application Management, go to Manage Web Applications.
  3. Select the Web Application, that gives you see this error.
  4. On the Ribbon, look at 4th icon from left that says “General Settings”, click on the arrow at the bottom of the button and select the second option “Resource Throttling”.
  5. In the dialog that opens, scroll down till you see “List View Lookup Threshold”, you would see that by default the value is 8. Increase to a number suitable to your requirements and save it by clicking on OK.
  6. Go again to the list/library that gave the error and it should be working now provided the value that you set as threshold is a more than lookups your list/library requires to do to show the content.



For the record, the following links were what helped point me in the right direction, however as you will find, not everything in here is correct.  I do believe they are good for reference, and to get a good idea of the inner-workings of AD RMS, SharePoint 2010 and IRM:

After doing a LOT of research on this issue I came to a conclusion; Microsoft SharePoint 2010 (all versions) support IRM out of the box, however, the free version (and I cannot speak to the paid versions) DOES NOT contain the Office Document Protectors by default, nor does SharePoint look anywhere near where Microsoft tells you that it looks when registering your custom IRM protector!  I believe that part of the misunderstanding as of this writing is that Microsoft simply copied over a bulk of the documentation used for IRM in SharePoint 2010 from an earlier version (SharePoint 2007).  Come to find out, this was the root cause of the problem I was having, but we will get back to that.

The Setup (basics)

After configuring Active Directory Rights Management Services, the next step is to download and install SharePoint Foundation 2010.  This is a pretty simple process, only really involving the prerequisites and hitting “next” a lot picking the defaults (in our example).  Once SharePoint is installed, you will need to enable Information Rights Management (IRM) at the SharePoint Management Console level, and then you will actually control what document or list libraries have IRM applied and the extent of the permissions on EACH library.  However in order for those options to work, SharePoint must be set to use your current AD RMS server, but I’ll leave the details to all of the documentation that is out there.  It is pretty simple and errors generally point to a misconfiguration of AD RMS, DNS, or incorrect registration (or no registration) of the SCP for RMS.

Once IRM is setup at the server (or server farm level), then just create your SharePoint site(s).  Once created, all the documentation out there for SharePoint 2010 implies that setting the document library settings to use rights management should “just work”.  However I found out very quickly that by checking the box in the library settings that would not allow me upload documents that could not be rights managed, that nothing would upload.  Nothing.  Uncheck that box, uploads work, but no rights are applied!  From here it was back to ensuring that AD RMS was working properly, that IRM was registered in Active Directory, but still I was getting the same problem, SharePoint was not seeing any documents types that would work with IRM.  I began to research even more and found one blog post on TechNet that mentioned although Microsoft stated SharePoint 2010 (including Foundation) would work with IRM/RMS it wouldn’t work out of the box the same way that the full (paid) versions do.  Unfortunately it did not go into any detail about how to make it work, just that it should work, but didn’t come with the needed components that would allow it to work.


The Plot Thickens

Armed with the knowledge that SharePoint Foundation 2010 does not include the needed components that we need in order to actually use the Microsoft Office document protectors (as that is all Microsoft specifies will work with SP 2010), it was simple enough to find several others that utilized the Microsoft Office File Format Protectorsin order to actually build the dll’s from Microsoft-provided source code and then install them into WSS 3.0.  Following the directions in the “Extend WSS 3.0 to Protect…” link above I installed Visual Studio 2010 (full version, but as a trial) to the server as I needed to build it as x64 bit AND ensure that the components were correctly registered on the server.  Unfortunately building the dll’s locally and moving them out to the server does not register the dll’s like we need, and manually registering them did not work, thus the install of VS 2010 on the server and just building the projects register the dll’s.  Now that I had made sure IRM was setup in SP, and now I had the dll’s registered on the server, my hope was that this should work.  Restarting IIS, attempting to upload a document was still telling me that it was not IRM-compatible. ARGH!

Back to research.  Things still were not working as I had anticipated, Microsoft Office document types (new and old) would not upload to SharePoint when I forced IRM protection to only allow documents that could be protected to be uploaded.  I had followed the other posts from Microsoft’s site, on How to: Register an IRM Protector and that even references SharePoint 2010, and goes into detail about the location of the registry keys at: HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\ and HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server  Extensions\12.0\.  everything was in its place, nothing was working.  So on to more documentation!  I parsed through (probably for the third time at this point) the MS documentation on Information Rights Management in SharePoint Foundation and decided that I wanted to go through their sample as I MUST be missing something in the code, or just not understanding something correctly when I hit another roadblock.  The Sample: Creating Custom IRM Protectors shows a fair bit of code (not all of it), and mentions that the “SampleDocProtector” code sample can be found  in the ECM Starter Kit in the SharePoint 2010 SDK.  Unfortunately after downloading the SDK and looking in the ECM Started Kit, it was not in there…What the what!?  Ok, so I re-routed my search and was able to find that there was also an ECM Starter Kit in theSharePoint 2007 SDK.  This might have been a good indicator that in fact Microsoft was a bit behind in their documentation, however I know this is not the first time I was pointed one place and had to go elsewhere, so I didn’t think much more about it.  My main goal here was to see their sample project and see exactly how it was building/registering itself with SharePoint (as there was also mention that it included a .reg file for registering the protectors and I hoped it would be something different than what the MS documentation was telling me).  No dice.  It was exactly what I expected.


More Dead Ends

At this point I had burned a lot of time, reinstalled SharePoint Foundation 2010 several times, and still couldn’t get as much as an error to show up in the event logs, SharePoint logs, IIS, anywhere!!  According to each application, everything was operating normally.  I installed Office 2010 Pro Plus on the server to ensure that the AD RMS client on the server had been activated and everything was accessible (and everything worked great using AD RMS in Office, but IRM in SP was still doing the same thing!).  I brought Nolan into the game at this point since I had been looking at this and reading up on it for days, all pointing back to that fact that it should “just work”.  We decided to try a few things that I had tried previously with some different twists, but no matter how we sliced it, the problem was the same, same error, and no matter how verbose the logs in SharePoint, we really weren’t able to discern what the problem actually was.  Enter the nightmare of the impatient, Process Monitor.


One of These Things Is Not Like the Other

Our first run of procmon was really to find out what was happening with SharePoint and where it was having a problem.  Our assumption was that there was a problem with SharePoint or the custom dll’s from Microsoft.  After a few hours of digging, re-digging and searching, we had another thought: what if we are looking for the wrong thing, instead of looking for what was wrong, we needed to look at what WASN’T happening.  Sure enough within minutes we were able to figure out that Microsoft’s documentation was incorrect and instead of registering the IrmProtectors in the registry under the HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\ we needed to register them at: HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\.  The problem was that all of the processes and everything that was happening with SharePoint, that it was not looking under the 12.0 sub key and was only looking at 14.0.  Once we made that change, restarted IIS, everything worked!!  To clean things up a bit, I searched the registry for the GUID’s of the Mso and Opc protectors (from the MS code that we built on the server) and changed the registration of the dll’s to point to a C:\Protectors folder where I copied the two dll’s to, and in addition for older MS Documents types to work (.doc, .xls, .ppt), you will also need to create a subfolder from where the dll’s are located named 1033, and place the provided templates (look in the templates folder of the project MsoIrmProtector) in there.  If you do not then you’ll get the same error when attempting to upload those older document types to SharePoint Foundation 2010 if the library requires only IRM-protectable documents.



For those of you that got lost in the novel above or just want a quick answer:

  1. Install and configure AD RMS
  2. Install and configure SharePoint Foundation 2010
  3. Configure IRM at the SP server/farm level
  4. Install VS 2010 (of export all the needed registry keys for the registration if you want to take the time) – and build the projects (ensuring they are set to use x64 if needed)
  5. Add in the registry keys under the HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server  Extensions\14.0\
  6. Restart IIS
  7. Test to ensure that at least the newer MS document types are working (.docx, .xlsx, etc.)
  8. If things work, continue, if not, troubleshoot any errors (look in event logs, SharePoint logs, etc.)
  9. Copy the dll’s from the project files to a more desired location (i.e.: C\Protectors)
  10. Copy the templates in the MsoIrmProtectors project to a subfolder of the dll’s location (i.e.: C:\Protectors\1033)
  11. Adjust the following Default keys to match the location in #9 above:
  12. HKEY_CLASSES_ROOT\CLSID\{2E4402B2-F2DA-4BC8-BB2C-41BECF0BDDDB}\InprocServer32
  13. HKEY_CLASSES_ROOT\CLSID\{81273702-956F-4CBD-9B16-43790558EE29}\InprocServer32
  14. Restart IIS
  15. Test to ensure all MS Office documents types supported are working.
  16. If you have a server farm, it would make more sense to actually create a setup project in Visual Studio and use that to create an installer that will make the changes needed for your environment instead of installing VS on each server, etc.


If you have any additional input, or need more information/assistance please contact Intrinium and we would be glad to help!  All the information needed is contained above in the article or one of the associated links.  I would highly recommend reading through the links and getting a solid understanding of AD RMS and IRM in SharePoint 2010 before even starting on this type of project.  And, as always, do this in a test environment and ensure that you have a full backup of all data before doing ANYTHING to a server.  If you choose to do this in a production environment, proceed with caution and only use AD RMS if you have the proper licenses!

Source: Intrinium Networks / IT Security > Blog – SharePoint Foundation 2010 and Rights Management.


Microsoft surely rocks…and here is the reason!

A good post here by “Good Coffee Good Code” guy explains the complete process and provides a sample solution here. Download and check it out!

In Pivot Viewer v2, sorting of multivalued facets is not taken care of automatically (i.e. if you are binding items in the non-cxml way). I took the sample provided at the end Pivot Viewer’s documentation here and changed the Employee class to:

public class Employee
	public Employee(string firstname, string lastname, DateTime? birthDate, string department, string office, string title, string officePhone, string personalPhone)
		FirstName = firstname;
		LastName = lastname;
		Birthdate = birthDate;
		Department = new List<string> { department, "D1", "D2", "D3", "D4", "D5" };
		Office = office;
		Title = title;
		OfficePhone = officePhone;
		PersonalPhone = personalPhone;

	public string FirstName { get; set; }
	public string LastName { get; set; }
	public DateTime? Birthdate { get; set; }
	public List<string> Department { get; set; }
	public string Office { get; set; }
	public string Title { get; set; }
	public string OfficePhone { get; set; }
	public string PersonalPhone { get; set; }

i.e. the “Department” variable is now of List<string> type. Then, I added “Department” as a Filterable Pivot Property in the xaml like:

<sdk:PivotViewerStringProperty Id="Department" Options="CanFilter" DisplayName="Department" Binding="{Binding Department}" />

The result was when I tried to sort on this property, it threw an error:

“Failed to compare two elements in an array. At least one object must implement IComparable”

As the error explains, the error comes because the List object doesn’t have an implementation for IComparable due to which the sorting is not supported. It kind of makes sense too since a generic sorting criteria of how a List object is compared with another cant be decided. To make this work, I created a custom class that inherits the List object and has an implementation for the IComparable interface. For the sorting comparison, I did it according to the number of items in an object compared with the other. I know its not going to be correct in most of cases, but hey…its just a feasibility shown here, you can sophisticate the sorting mechanism as much as you like! 🙂 The custom class goes like:

/// <summary>
/// Custom class to support multivalued facets sorting
/// </summary>
public class StringFacets : List<string>, IComparable
	#region Implementation of IComparable

	/// <summary>
	/// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
	/// </summary>
	/// <returns>
	/// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes <paramref name="obj"/> in the sort order. Zero This instance occurs in the same position in the sort order as <paramref name="obj"/>.Greater than zero This instance follows <paramref name="obj"/> in the sort order.
	/// </returns>
	/// <param name="obj">An object to compare with this instance. </param><exception cref="T:System.ArgumentException"><paramref name="obj"/> is not the same type as this instance. </exception>
	public int CompareTo(object obj)
		var stringFacet = obj as StringFacets;
		if (stringFacet == null)
			return -1;

		if (stringFacet.Count < this.Count)
			return -1;
		if (stringFacet.Count == this.Count)
			return 0;
		if (stringFacet.Count > this.Count)
			return 1;

		return -1;



And the class is to be used as follows in the Employee class:

public StringFacets Department { get; set; }


Now, when you will try to sort the items based on the  “Department” category, it would work like a charm. The code is available at

If you would like to share any improvement, its going to be awesome!

Pivot Viewer v2 (released as a part of SL 5 RC) is one of smartest improvements done by MS to its own products. However, there are still somethings which are not very clearly available. For instance, sorting multivalued facets, custom actions, etc. In this series of blogs, I am going to explain to you how one can do the tasks which were quite easy in the old version of Pivot Viewer but not so straight forward in this version and then later I’ll take you through how you can harness the power of this newer version of the super awesome product. The series will evolve as follows:

Stay tuned!