Welcome to my blog, stay tunned :

My top 10 sanity checks when performing SharePoint code review

1. Checking for memory leaks

Memory leaks are the big evil but most of the times, it is important to have a pragmatic approach when hunting them .

First, a short reminder of what a memory leak is: a memory leak is a space in memory that was not released after use. Before hunting them, it is important to focus on the parent process that executes them. Sometimes, I see people trying to find memory leaks in PowerShell scripts…While it is always a best practice to release the memory as soon as you are done with it, this is not an absolute necessity when dealing with scripts since they are most of the time executed during a short amount of time and when PowerShell.exe stops running, the memory associated with the process gets released automatically.

So, I would definitely not spend time in a large-scale SharePoint implementation on chasing memory leaks in PowerShell scripts.

Here are the top 3 components that must be monitored closely according to me:

The Timer Jobs: since they are executed every xx minute/hours/days/weeks, they can, therefore, regularly cause new leaks. Moreover, they are executed by OWSTIMER, a permanent process running on the server(s), thus not releasing memory until it stops or until you explicitly dispose of your objects (simplification here…).

Farm deployed WebParts/WebControls: and basically all the controls that are handled by w3wp.exe for the same reason as the above. Although w3wp.exe are usually recycled automatically by IIS, it’s important to make sure they are not recycled unexpectedly because of your components.

SandBoxed Solutions:again, they are executed by permanent processes running on the server(s). With SandBoxes, SharePoint already controls the resources used but it’s still necessary to review the code.

Of course, to find those memory leaks, it’s always handy to have a tool and this tool is quite famous now in the SharePoint world and is called SPDisposeCheck.

http://archive.msdn.microsoft.com/SPDisposeCheck


2. Checking the number of SPSite and SPWeb objects that are instantiated

As you probably know, instantiating SPSite & SPWeb objects require a lot of resources, therefore, I tend to instantiate them only when absolutely required. So, I’m looking for patterns like this one:

class Utils  
{  
  public string GetWebTitle(string url)  
  {  
    using(SPSite Site = new SPSite(url))  
    {  
      using(SPWeb Web=Site.OpenWeb())  
      {  
       return Web.Title;  
      }
    }  
  }  
  public string GetWebList(string url, Guid listid)  
  {  
     using(…)//same as above  
  }   
} 

DropBox for SharePoint now includes tagging to integrate better with SharePoint 2010 social framework

Hi,

The DropBox for SharePoint application released one month ago ( for more info, visit this post http://www.silver-it.com/node/90 ) now includes the I Like It functionality.

DropBox for SharePoint is available for download on CodePlex.

The standard white icon allows you to Like a DropBox item. All the items marked with a green background are already tagged with the I Like this DropBox Document tag.

SharePoint 2010, deploying a BCS Model using a farm property bag to have a dynamic siteurl

Hi,

As you probably noticed and as I've observed on the web, many people complain about the fact that when deploying a BCS model with Visual Studio, you have to specify a value for the feature property SiteUrl. If you don't, you might have troubles depending on your topology as described in the following blog posts http://trentacular.com/2011/05/deploying-sharepoint-bdc-models-via-features-without-specifying-a-siteurl/ and http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/07/30/deploy-your-bdc-model-to-a-specific-bcs-service-using-visual-studio-2010.aspx

SharePoint User Profiles + BCS + XML Serialization problems when data is not sanitized

Hi,

Let me tell you a (true) story that happened to me recently...I was playing around with SharePoint for one of my customers and faced a problem I never encountered before. To my surprise, I didn't find anything on the web describing that issue and of course, describing how to fix it!

The User Profile engine is certainly one of the most complex component of SharePoint. Looking at ForeFront Identity Manager can give some headaches...

Well, here is the scenario that can lead to some troubles :

  • Your primary UP data connection is Active Directory

Releasing DropBox for SharePoint Server 2010

Hi,

I've just released a new application called DropBox for SharePoint on CodePlex.

Click here to download a video demonstrating the DropBox.

Click here to read the manual.



What DropBox for SharePoint is :

Dashboard helper for the SharePoint developer dashboard

Hi,

I've just released on CodePlex a very small tool that helps identifying faster consuming operations with the SharePoint developer Dashboard.

This solution is intended to be used by developers/admins only. Here are a few screenshots showing the functionality:

When you have activated the site collection feature and when the SharePoint developer Dashboard has been enabled, you should have an extra window:

Customizing the master page of Office 365 public site

When you have an Office 365 environment, you can decide to create a public facing site, meaning that your visitors won't need to be authenticated to visit this site.

This public facing site will most of the time show information about your company, describe your services etc...

By default, the public facing site looks more or less like this

If you have enough permissions, you'll be able to amend the logo, the company name and a few other information.

Office 365 customization, from excitation to frustration

After a while of struggling, I could eventually benefit from an Office 365 environment for which I had already developed a solution. The first thing I did was of course to test my solution with Office 365.

First, a bit of history : I developed a rating solution for SharePoint 2007 & 2010 (Foundation) and I've been asked recently to embed that into a SandBoxed solution.

One step further with the BCS and the StreamAccessor

Hi,


The BCS now starts to be well known by all the fellow SharePoint developers but what we often find on the web is how to interact with *basic* tables and *basic* field types.


What about binary streams? So, what about accessing blob data stored in a custom database and interact with them via the BCS? There is already a very good answer to this on MSDN at http://msdn.microsoft.com/en-us/library/ff634782(office.14).aspx . I encourage you to read this article first before going further unless you are already familiar with the StreamAccessor stereotype.


However, it focuses on how to build a model that includes the StreamAccessor stereotype, then how to import and use the model using the Business Data List webpart but not on how to use this StreamAccessor directly in your own components. While this is already a valuable information, it doesn't provide the full picture.

I'll try to shed some more light on the StreamAccessor. At the time of writing:

- StreamAccessor cannot be implemented with SharePoint Designer
- blobs can be used in external content types but cannot be used in External Lists. If you include such a field, this will break the forms associated to the operations (Create/Edit...).


So, as you can see, you cannot use such field types in External Lists. The purpose of this post is to show you how you can use the Business Data API in a custom webpart to perform read/write operations on blobs.


In this example, I'm using the same LOB System than the one found on MSDN:AdventureWorks and I'm also interacting with the table Production.Document. I've just added a Create operation with SharePoint Designer including the field Document in order to be able to add entries.

Here are two screenshots of the basic webpart we'll implement, a reading section:

and another section where you can upload a new document that will be pushed to the database:

Using the SharePoint Client Object model from within a custom Document Information Panel

Hi,

I've just recorded a new video on the above topic, if you're interested to watch it, it's here:

http://channel9.msdn.com/posts/Using-the-SharePoint-Client-Object-model-...

Happy Coding!