Archive for April, 2011

File Name, Length, Size and Invalid Character Restrictions and Recommendations

April 26, 2011

New Blocked File Types

If you were familiar with the WSS 2.0 list, there are some new Blocked File Types: .asmx, .rem, .resx, .soap, or .ashx.  If they existed before upgrade they are no longer visible or cannot be opened after upgrade.  These file extensions have been added to the list of blocked file extensions.

You now have the ability to make differences between farm wide blocked file types and web application blocked file types.  If you want to un block it, it needs to be removed at both farm and application levels, but you can add specific blocked files for a single web application.  The farm level block list for example will override anything removed at the web application level.

My most commonly removed blocked files are .chm (help files), .lnk (url link), .url (url link) 

My most commonly added blocked files are .mp3 (audio), .pst (mail), .vhd (virtual hard drive)

Site Names

-In WSS Site Names may not contain the following characters: \ / : * ? ” < > | # { } % & ” ~ +

-You cannot start a site name, sub site name, or a site group name with an underscore (_) character or with the period character (I recommend avoiding the (_) underscore in site names)

-You cannot use the period character consecutively in the middle of a site name

-You cannot use the period character at the end of a site name

File Names

-Invalid characters: ” # % & * : < > ? \ / { | } ~ 

-Cannot be longer than 128 characters

-You cannot use the period character consecutively in the middle of a file name

-You cannot use the period character at the end of a file name

-You cannot start a file name with the period character

Folder Names

-You cannot use the following characters anywhere in a folder name or a server name:  ~ # % & * { } \ : < > ? / | “

-Cannot be longer than 128 characters

-You cannot use the period character consecutively in the middle of a folder name

-You cannot use the period character at the end of a folder name

-You cannot start a folder name with the period character

Max File Upload/Download Sizes

The default max single file upload size is 50 MB by default for a web application.  

Microsoft IT limits their environment at 100 MB, and the maximum that the product itself can handle or support is 2GB which is essentially a SQL limit.  By setting the limit to blank will essentially support what SQL will support.

Increase the maximum upload size

1.  Click Start, point to All Programs, point to Administrative Tools, and then click SharePoint Central Administration.

2.  Under Virtual Server Configuration, click Configure virtual server settings.

3.  On the Virtual Server List page, click the virtual server you want to change.

4.  On the Virtual Server Settings page, under Virtual Server Management, click Virtual server general settings.

5.  Under Maximum upload size, type the maximum file size (in MB) that you want to allow to be uploaded.

6.  Click OK.

1. Get into the SharePoint Central Administration Site

2. Select “Application Management”

3. Under the “SharePoint Web Application Management” section select “Web Application General Settings”

4. Change the “Maximum Upload Size”

If IIS is timing out when you upload large files, you can configure the Connection timeout setting in IIS to allow more than the default 120 seconds (2 minutes).

Tune the IIS connection timeout

1.    Click Start, point to All Programs, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.

2.    Right-click the virtual server you want to configure, and then click Properties.

3.    Click the Web Site tab.

4.    In the Connections section, in the Connection timeout box, type the number of seconds you want IIS to wait before timing out.

5.    Click OK.


Viewing a image in data view web part

April 21, 2011

In order to combine the list with the picture library ,please add a link datasource.

In my local test ,I used the “Title column as a key to combine the list with the picture library. Here are the steps:

1. Open the site using Microsoft Office SharePoint Designer 2007.

2. On the “Task Panes” menu, click” Data Source Library”.

3. In the “Data Source Library” task pane, under “Linked sources”, click “Create a new Linked Source”.

4. In the “Data Source Properties” dialog box, on the “Source” tab, click “Configure Linked Source”.

5. In the Link Data Sources Wizard,click your list , and then click Add. Next, click thepicture librarythat you want to link with the list, and then click “Add”.

6. Under “Select the link type that best represents the relationship between the selected sources”, click Join the contents of the data sources by using the datasource details to insert data views and joined subviews.

7. Click finish.

After that, a dataview will be created :

1. On the “File” menu, click “New”.

2. In the “New” dialog box, double-click “ASPX”.

3. On the “Data View” menu, click “Insert Data View”.

4.In the “Data Source Library” task pane, click the plus sign (+) next to “Linked Sources”, click the DataSource created before steps, and then click “Show Data”.

5. In the “Data source Details” task pane, in the list “contact???folder, click “Title”.

6.Click “Insert Selected Fields as”, and then click “Multiple Item View” to insert the selected data into the Data View.

7.In the Data View, right-click the “Title” column, click “Insert” on the shortcut menu, and then click “Column to the Right”.

8. Position the insertion point inside a cell in the new column.

9. In the “Data Source Details” task pane, in thepicture libraryfolder, click “FequiredField”.

10.Click “Insert Selected Fields as”, and then click “Joined Subview”.

11.In the “Join Subview” dialog box, under “list”, click “Title”. Under “picture library”, click “Title”, and then click “OK”.

12. In order to display the picture, you must set “FequiredField” column’s format as picture. Hover the mouse on the column, andyou will see the menu.

In order to obtain more on dataview webpart, you can refer to :

“Access Denied” when Editing Task in a Workflow

April 13, 2011

This one was *really* weird stuff.

– There is a SPD-created workflow that creates successive approval tasks, using Collect Data From a User action
– This workflow is hosted on a subsite that has unique security
– After the workflow is created, I add a new user with Full Control permissions over the site, let’s call him johndoe
– Johndoe initiates a workflow, as he wants to try the workflow
– The workflow creates a task for another user, as expected
– Johndoe clicks the task in the task list, it shows the task data, as expected (johndoe has Full Control over the site, right?)
– Johndoe clicks the “Edit Item” to impersonate the user
– “Access denied” message appears!

I wandered why a user who has Full Control rights over the site cannot edit a task. The task itself had inherited permissions from the host site, giving johndoe Full Control over itself. Extensive Googling took me to this MSDN Forum post.

I tried the suggested solution of publishing the site to a local disk. After this, johndoe can edit the task. It smells like a bug inside SharePoint workflow infrastructure.

Calling LoadLibraryEx on ISAPI filter failed for CRM DefaultAddonFilter.dll

April 12, 2011

HTTP Error 500.0 – Internal Server Error
Calling LoadLibraryEx on ISAPI filter “C:\Program Files\Microsoft Dynamics CRM Server\Server\bin\DefaultAddonFilter.dll” failed.

The CRM application server was hosted on a 64-bit server with 8GB memory, running Windows Server 2008 R2, IIS7.

The cause of this problem was related to missing Microsoft Visual C++ 2008 SP1 runtime components.  After installing these component, CRM worked like a charm.

Below are links to the runtime libraries in case others run into this issue:


Javascript code to get the System User settings: like dateformat, email etc in CRM

April 11, 2011

This code sample uses the timezonedefinition entity.

//Set the CrmService

CrmService s = new CrmService();CrmAuthenticationToken token = new CrmAuthenticationToken();”MicrosoftCRM”;CredentialCache.DefaultCredentials;RetrieveUserSettingsSystemUserRequest req = new RetrieveUserSettingsSystemUserRequest();new AllColumns();new Guid(“{304d27d5-39d0-dc11-aa32-0003ff33509e}”);RetrieveUserSettingsSystemUserResponse res = (RetrieveUserSettingsSystemUserResponse)s.Execute(req);usersettings userSettings = (usersettings)res.BusinessEntity;

token.AuthenticationType = 0;

token.OrganizationName =

s.CrmAuthenticationTokenValue = token;

s.Credentials = System.Net.

//RetrieveUserSettings TimeZone Code

req.ColumnSet =

req.EntityId =

//Query the timezonedefinition Entity

QueryExpression query = new QueryExpression();

//Target the userinterfacename column e.g. (GMT-08:00) Pacific Time (US & Canada)ColumnSet Columnset = new ColumnSet();new String[]{“userinterfacename”}; EntityName.timezonedefinition.ToString();

Columnset.Attributes =

query.ColumnSet = Columnset;

query.EntityName =

//Retrieve the TimeZone the match the user codeConditionExpression condition = new ConditionExpression();”timezonecode”;ConditionOperator.Equal;new object[]{ userSettings.timezonecode.Value.ToString() };FilterExpression filter = new FilterExpression();new ConditionExpression[]{ condition };LogicalOperator.And;BusinessEntityCollection resultTimeZone = service.RetrieveMultiple( query );

condition.AttributeName =

condition.Operator =

condition.Values =

filter.Conditions =

filter.FilterOperator =

query.Criteria = filter;

Console.WriteLine( ((timezonedefinition)resultTimeZone.BusinessEntities[0]).userinterfacename );

//Result: (GMT-08:00) Pacific Time (US & Canada)

Here is the complete example.


token.AuthenticationType = 0;

token.OrganizationName =

service.CrmAuthenticationTokenValue = token;

service.Credentials = System.Net.

/* RetrieveUserSettings */

RetrieveUserSettingsSystemUserRequest req = new RetrieveUserSettingsSystemUserRequest();new AllColumns();new Guid(“{304d27d5-39d0-dc11-aa32-0003ff33509e}”);RetrieveUserSettingsSystemUserResponse res = (RetrieveUserSettingsSystemUserResponse)service.Execute(req);usersettings userSettings = (usersettings)res.BusinessEntity;

/* GetAllTimeZones */

GetAllTimeZonesWithDisplayNameRequest timeZonesRequest = new GetAllTimeZonesWithDisplayNameRequest();timeZonesRequest.LocaleId = 1033;

/* Match User Timezone */

foreach (BusinessEntity businessEntity in timeZonesResponse.BusinessEntityCollection.BusinessEntities) timezonedefinition timeZone = (timezonedefinition)businessEntity; if( userSettings.timezonecode.Value == timeZone.timezonecode.Value ) Console.WriteLine(timeZone.userinterfacename);



GetAllTimeZonesWithDisplayNameResponse timeZonesResponse = (GetAllTimeZonesWithDisplayNameResponse)service.Execute(timeZonesRequest);

req.ColumnSet =

req.EntityId =

service = new CrmService();CrmAuthenticationToken token = new CrmAuthenticationToken();”Organization Name”;CredentialCache.DefaultCredentials;

RetrieveUserSettingsSystemUserRequest Class

How to restict users from entering special characters in Microsoft Dynamics CRM 4.0

April 8, 2011

Solution is very simple – just add following script to OnLoad event handler of form:

function SwitchOnCheck(ElementId)
    var element = document.getElementById(ElementId);
    if (element != null)
        element.attachEvent("onkeyup", function()
    var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
    var strPass = element.value;
    if (strPass == null)
    var strLength = strPass.length;
    var lchar = element.value.charAt(strLength - 1);
    while( != -1)
        strPass = strPass.substring(0, strLength - 1);
        if (strPass.length == 0)
        strLength = strPass.length;
        lchar = strPass.charAt(strLength - 1);

    element.value = strPass;


SharePoint Backup Restore, High Availability, and Disaster Recovery

April 4, 2011

What to Backup

1. All Servers and all drives in the farm including system state: includes metabase, system state, home directories, web.config, install path, custom assemblies, binaries and code, customizations, site defs, list defs, IIS logs, evt logs, etc… (Doesn’t even need to be daily if this concerns you…)

2. Databases – All your data and 99.97% of config is stored in SQL

3. Index – The index will be propagated to the query servers, but you can’t recover it from there if you have system failure, drive, sector, or file corruption.  The two ways to backup your index is via Stsadm –o backup and with the central admin.  The two can be used interchangeably.

Tools and APIs 

  • · Native SQL Server Backup & Restore – Native SQL backup can be used to backup all databases (Note: Does not include index (even though you’ll see it can backup the search and SSP database.)  You can even use the jobs to schedule or create some interesting scripts to do multi threaded backups.
  • · SQL 2005 Database Mirroring – mirrors of your data in another location for location, data, and hardware fault tolerance.  See the White paper: Using database mirroring for details. 
  • · SQL Log Shipping to a Standby farm or server – pretty much the same as with SPS 2003.  You can use this with SQL 2000 or SQL 2005 to a read only SQL box connected to a stand-by farm and fail back or read/write and log ship back. 
  • · SharePoint Backup and Restore (Central Admin) – UI based backup for farm including services like Index… includes full and differential backup. (Requires a full first, to perform any diffs.) 
  • · Stsadm Utility – stsadm –o backup/restore, stsadm –o export/import, the stsadm command is pretty powerful.  You can schedule this with a scheduled task to run nightly, failures will result in an error in the error log which you can capture in MOM or your monitoring environment…  Includes full, differential, partial backups of services or individual web apps, site collections, sites 
  • · VSS Writer – Snapshots can be completed to capture point in time backups of the databases.  (See note in gotchas below.) 
  • · Web delete event— The events are in the system and can be captured.  MS IT has a working prototype of a site and site collection archive on delete solution deployment they plan to share after they “bake it in”. 
  • · SharePoint Designer—you can use SharePoint designer as an end user means of backing up a site or site collection. 
  • · Recycle Bin – one of the best new features of the product.  Right out of the box when a web app is created, files, lists, and list items are retained for 30 days (configurable) before deletion.  The second stage, the site collection admin stage allows you to recover documents deleted by users (even the site admin him or herself) 
  • · Migration API (Prime)  – This API is a powerful way to copy (import/export) data with SharePoint Products & Technologies. (see the SDK for more info) 
  • · DPM 2.0 (beta) – Data Protection Manager 2.0 is being designed to backup SharePoint Farms and is early in the beta cycle.  This disk based backup solution is designed for consolidated backup solutions and differencing.  Look for more on this in the future.  (This is a separate Microsoft product, but plans to have a SharePoint solution)

 High Availability

  • · Web Front End: Web front ends can be easily made redundant via load balancing solutions, software, hardware… either work.  Be sure to use sticky sessions and be sure to test forms deployments with your load balancing solutions.  NLB is the most commonly used intranet solution, Cisco Local Director, F5 Big IP, etc… are common hardware load balancers 
  • · Query: Query aka Search Servers are easily redundant through the services built into the product.  All web servers need to communicate to all query servers even if there is a query service local to the box.   
  • · Index: This is a single point of failure as a service, but if the index box goes down, the users won’t be impacted.  If the index box goes down and you bring it back up service will not be interrupted.  Exceptions to be aware of are if the query box was in the middle of propagation and then the service were to go down.  The query box needs to think it is up to date and has the correct catalogs.  If the query ever thinks it is out of date and is unable to contact the Index box, you will get errors on search requests.  The most creative but ugly scenario for making your index redundant is to create an additional farm that is a single box that has indexing services on it.  That single box farm would have a copy of the index or have it’s own indexing schedule.  Thus if a failure were to happen you could update the connection of the SSP to the other farm.  Not sure who’d do this, but it’s possible. 
  • · SQL – SQL Clustering provides for a high available SQL platform.  Bascially it’s shared disks with failover between systems ensuring fault tolerance to hardware issues.  You can do clusters in either SQL 2000 or SQL 2005.  You can do SQL Log shipping on top of clustering or without it for further fault tolerance and high availability.  SQL Mirroring is another option is you are using SQL 2005 more detail above.

Gotchas: (Snipped from Using Backup and Restore (Office SharePoint Server 2007) TechNet article)

STSADM Backup and restore will not backup and *restore* the following:

  • · The configuration database

o Any Custom solutions deployed (be sure to keep the solutions so they can be easily re-deployed)

o Alternate access mappings

o The Central Administrator Web Application

o The Central Administrator content database

o The Internet Information Services metabase

Additional Data on VSS

  • · The VSS Writer service needs to be registered using the “stsadm –o registerwssservice” command.
  • · The SQL Server VSS Writer service, which is available with SQL Server 2005, needs to be started for the Windows SharePoint Services Writer to work properly. By default this service does not start automatically. For more information about Volume Shadow Copy service (VSS), see Volume Shadow Copy Service Technical Reference and for more information about the SQL Server VSS Writer, see SQL Writer in SQL Server 2005.

Additional Resources:

Some Third Party Vendors:

AvePoint: Farm and Granular Backup and recovery (see DocAve 4.1 for MOSS 2007 and WSS 3.0)

Commvault: SharePoint Farm backup and granular recovery

Neverfail: High Availability and DR solutions

Quest: Compressed database backup with Litespeed and Recovery Manager (SPS 2003 and MOSS 2007)