Tuesday, January 11, 2011

HowTo - SharePoint - Get a list of SSPs in code

Ever wanted to get a list of all the Shared Services Provider (SSP) in a SharePoint Farm, for example to retrieve all the search service instances in a Farm?


To accomplish this, we need to walk through all the web application and determine if the web application is a SSP web application. We can do this by validating if the web application contains a property called “Microsoft.Office.Server.SharedResourceProvider”. The property “” contains a property “AdministrationSiteId”, which is the id of the SSP Administrator Site.

Remark: in most situation we will get two web applications, for a single SSP, with the “Microsoft.Office.Server.SharedResourceProvider” property. This because in most situation we have a Search web application and a MySite web application for a SSP.

The code will look like this:

 private StringCollection GetAdminSiteIDs(SPFarm farm)
{
   StringCollection colAdminSites=new StringCollection();
   SPWebService webService = farm.Services.GetValue();
   foreach (SPWebApplication webApp in webService.WebApplications)
   {
      //Check if the web app contains a property Microsoft.Office.Server.SharedResourceProvider,
      //which indicates it's a SharedResourceProvider.
      if (webApp.Properties.ContainsKey("Microsoft.Office.Server.SharedResourceProvider"))
         {
            object ssp = webApp.Properties["Microsoft.Office.Server.SharedResourceProvider"];
            
            //Get the guid of the Administration Site
            Guid sspGuid = (Guid)ssp.GetType().GetProperty("AdministrationSiteId").GetValue(ssp, null);

            //Check if the site is already processed, because for each SSP, we get two SharedResourceProvider
            //one Search and one MySite.
            if (!colAdminSites.Contains(sspGuid.ToString()))
            { 
               colAdminSites.Add(sspGuid.ToString());
            }
         }
   }
   return colAdminSites;
}

Wednesday, August 25, 2010

How to boot from Microsoft SharePoint 2010 VHD using Windows 7

This post describes the steps to boot your computer from the Microsoft SharePoint 2010 VHD (2010 Information Worker Demonstration and Evaluation Virtual Machine )


  • Download the VHD.
  • Run the command compmgmt.msc.
  • Right mouse click on Disk Management and click Attach VHD.

  • Click Browse and select the vhd from which you want to boot.
  • The vhd should now be visible as a disk and you should be able to browse the vhd in the Windows Explorer.
  • Open command prompt (As Administrator).
  • Type the command bcdedit /copy {current} /d "VHD_Boot" You should see a message like the one below.

  • Copy the guid from the success message from step 1, and run the command:
bcdedit /set {CLSID_Number} osdevice vhd=[C:]\2010-7a.vhd

  • Now restart your computer, and you should be able to boot from the vhd, and you should see something like the figure below:


Tuesday, August 10, 2010

Just a test to see if SyntaxHighlighter is working ok

/// 
/// Just a HelloWord method to test the SyntaxHighlighter on my blog.
/// 
public void HelloWorld()
{
       Page.Response.Write("SyntaxHighlighter Test");
}

Monday, May 3, 2010

Dutch proofing tools Office 2010 Beta

By default the Dutch proofing tools are not available in Office 2010 beta. To get Dutch proofing tools available in Office 2010 beta:

  1. start Word and go-to File -> Options -> Languages
  2. make another language other then Dutch the default.
  3. remove the Dutch language and close Word.
  4. Download the French Microsoft Office 2010 Beta Language Pack
  5. Install the Frensh language pack
  6. start Word and go-to File -> Options -> Languages
  7. make Dutch the default.




Speed-up-SharePoint

Add crl.microsoft.com to your host file. For more information see Speed-up-SharePoint

Saturday, April 10, 2010

EntityDataSource Where with relationships

The EntityDataSource control can be used with a data-bound control to retrieve data from an EDM and to display. Most of the samples just display data based on a single table. Just what I want, but I had one more requirement. I required a filter based on a related table.


 
First let show the EDM modal:

 

I have two tables:
  • Dossier: contains all the dossier in the company.
  • Access: specifies which departments have access to a dossier.

 
My Grid needed to display all the dossier a specific department was the owner (Dossier.OwnerId) of or had access to (Access.DepartementId).

 
In the sample below, I assume the departmentId is 1.

 
The first requirement was very simple: just create a where on the OwnerId like:


But the second requirements cause me trouble. First of all I needed to make sure the Access table was included in my "query". Second the where needed to query on a the Access table which was a collection on the Dossier object (because of the 1 to many relationship).


Solution:

 

Thursday, March 4, 2010

Logging to the SharePoint log in custom SharePoint solutions

Logging information about your application is not nice to have, but a must. A good log, can help you debug and fix problems.
SharePoint logs information by using the Unified Logging Service (ULS). Wouldn't it be nice if you good create the same behaviour in your own custom SharePoint solution??


You can!! Use the The SharePoint Logger of the Developing SharePoint Applications Guidance .