Monday, October 22, 2012

Find out which process has locked a file?


Sometimes, you try to delete a file and receive access violation or file in use - errors. To successfully delete a file, you will need to identify the process which has locked the file. Since Windows Vista this is quite easy. Perform the following steps to know which process has locked a file:


  1. Start the task manager (CTRL + Shift + Esc)
  2. Go- to the Performance tab
  3. Click Resource Monitor
  4. Select the CPU tab
  5. In the search box, of the Associated Handles group, specify the name of the file which is locked and click enter.
  6. And there you go. 


Wednesday, November 23, 2011

Chrome Query

When creating websites I often use jQuery's .data() function to add data to elements. When debugging my web site I sometimes want to know what data is attached to an element.
For Google Chrome there is a extension Chrome Query which allows me to view jQuery data (it’s still an experimental extension).
Chrome Query:Extends the Developer Tools, adding a sidebar that displays the jQuery data associated with the selected DOM element.

To install the Chrome Query extension:
  1. First enable the experimental API support in Chrome.  Start Chrome, Go to chrome://flags, find "Experimental Extension APIs", click its "Enable" link, and restart Chrome. From now on, unless you return to that page and disable experimental APIs, you'll be able to run extensions that use experimental APIs.
  2. Extract the package
  3. Click on Load unpacked extension
  4. Select the folder where you extracted the extension and click OK.

Monday, October 31, 2011

CheckAsm

If you know and use Dependency Walker (depends.exe), you will probably need CheckAsm too. CheckAsm is just "depends for .NET".
CheckAsm is an assembly dependency viewer. It shows all .NET assembly references of any .NET assembly. This means you can always find what references are incorrect, which assemblies are missing, and why your application can not start.

Tuesday, September 13, 2011

smtp4dev

Some of my colleagues pointed me at a little “SMTP Server”, called smtp4dev. It’s an SMTP server that listens on your local machine and captures all messages, which you can easily view and open. Very handy when you send email message in your application and you want to see how the message looks, without the requirement to install a real SMTP Server.


Other SMTP servers you could consider to use:
  1. Squirrelmail
  2. SurgeMail

Uninstall MSI which fails to uninstall

Uninstall MSI which fails to uninstall sounds like strange, but it is possible.

Sometimes when you try to uninstall a msi the msi fails to uninstall with an error message like, the screenshot below.
This could be caused by a custom action which fails to execute.

To indicate if this is really the problem run the uninstall with the following command:

C:\Temp\ Setup.msi /log c:\uninstall.log

(if you don’t know where the msi is located, search the registry on the product name and you will find it. You should search until you find a match in “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData” like “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\B2729D7731537264797FB846DDDCF225\InstallProperties”)

The log file should now contain something like:
(The black line containing the name of the custom action). To make it possible to uninstall the product perform the following steps:
  1. Locate the msi in the C:\Windows\Installer\ (search in the registry on the product name and you will find it).
  2. Make a backup of the msi (you never know what happens)
  3. Open the original msi file in Orca.
  4.  Locate the CustomAction table.
  5.  Select the CustomAction which cause the problem.
  6.  Delete the selected custom action.
  7. Save the msi and close Orca.

Thursday, January 13, 2011

HowTo - SharePoint - Build a WSP for an Index Server

I created a solution for SharePoint which must be installed on all the Index Servers in a Farm. So I build a WSP solution with WSPBuilder and I thought that would be it. Because had some code in the feature activate of one of my feature, I thought let’s test the wsp in an environment where my Index Server is a dedicated Index Server (so not a Frontend Server).


To my astonishment, I found out that the WSP was only deployed to all the Frontend servers in my Farm but not to the Index Server :(

Cause

A wsp contains a manifest.xml, which looks like this:

 
 
 
 
 
 
 
 
 


 
When you build a WSP using WSPBuilder, by default the Solution element does not contain a DeploymentServerType attribute, which is the cause of the problem. The DeploymentServerType has the following description:

DeploymentServerType : Optional. Default=WebFrontEnd. This attribute indicates the target of your solution to either a web front end server (WebFrontEnd) or an application server (ApplicationServer).

Solution


Make sure the DeploymentServerType is specified in the manifest.xml. To accomplish this, you need to edit the WSPBuilder.exe.config (in my case in the folder C:\Program Files\WSPTools\WSPBuilderExtensions), and add the attribute DeploymentServerType.


 
 
 

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 .

Thursday, January 7, 2010

Thursday, December 3, 2009

BDC Crawl Error - Access Denied By BDC


Symptoms

When you created a BDC definition and starts crawling the content, you get an error message "The parameter is incorrect. (Access denied by BDC)".




How to solve the problem

When you have a problem in SharePoint there are several places to find more information about the error:
  • EventLog
  • SharePoint log "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS"
  • SQL log
Perform the following steps to figure out what the problem is:
1. In this case we start looking the the SharePoint log, because that's will probably the best place to get more information about the problem. So open the log file (if there are many log files, open the one which starts with your server name, and is the latest one).
2. Search for Access Denied.
3. If you find something like the message below, this post will probably describe your problem.
Access Denied for User 'JKNDEVSRV01\SPSearchService'. Securable MethodInstancewith Name 'EmployeeIDEnumeratorInstance' has ACL that contains: User 'JKNDEVSRV01\administrator' with Rights 'Execute, Edit, SetPermissions, UseInBusinessDataInLists, SelectableInClients'

4. The message below indicates that the Account which is used to crawl you BDC data as not enough rights to crawl the data.


Solution

Make sure the account which performs the crawling (Default Content Access Account) has enough rights on the BDC Definition.
Perform the following steps to solve the problem:

1. In the SharePoint Central Administrator go-to the Shared Service Provider -> BDB Application -> AdventureWorks -> Customer -> Manage Permissions, see figure below. (in this case AdventureWorks is my BDC Application and Customer is the entity to crawl.)




2. Make sure the crawling account is in the list and has at least Execute permissions.

Remark: After I published this post, I found some interesting link to the Microsoft site, which BDC Warnings and Error Messages.