Archive for December, 2009


To close a window using JavaScript we normally use

window.close();

In this case you will get a confirmation pop-up pop up with OK & Cancel button. If you want to close the window without the confirmation pop-up, you can use the below code

window.open(”, ‘_parent’, ”);
window.close();


SharePoint 2010 Developer Videos

Site Collection Quotas and Locks

Posted: December 18, 2009 in Administration

Quotas and locks are two ways of controlling access to site collections. Using locks, you can manually prevent user access. Using quotas, you can prevent users from adding content to a site collection or you can send e-mail warnings to the site collection administrator when specified disk space thresholds (in megabytes [MB]) are exceeded. 

  1. On the top navigation bar, click Application Management.
  2. On the Application Management page, in the SharePoint Site Management section, click Site collection quotas and locks. The Site Collection Quotas and Locks page opens.
  3. If you want to change the selected site collection, in the Site Collection section, on the Site Collection menu, click Change Site Collection. Use the Select Site Collection page to select a site collection.
  4. On the Site Collection Quotas and Locks page, in the Site Lock Information section, select one of the following:
    • Not locked. Select this option to make the site collection unlocked.
    • Adding content prevented. Select this option to prevent users from adding new content to the site collection. Updates and deletions are still allowed. You are required to type a reason for the lock in the Additional lock information box.
    • Read-only (blocks additions, updates, and deletions). Select this option to prevent users from adding, updating, or deleting content. You are required to type a reason for the lock in the Additional lock information box.
    • No access. Select this option to prevent access to content entirely. Users who attempt to access the site will receive an access-denied message. You are required to type a reason for the lock in the Additional lock information box.
  5. In the Site Quota Information section, in the Current quota template list, click a quota for the site collection.
  6. If you want to override the storage limit that is specified in the selected quota template, select the Limit site storage to a maximum of check box, and type a value in MB in the corresponding box.
  7. If you want to override the e-mail warning threshold that is specified in the quota template, select the Send warning e-mail when site storage reaches check box, and type a value in MB in the corresponding box.

Some times the Lock Status will be set to “Read-only (blocks additions, updates, and deletions)” during the backup process which will result in preventing users to add caontent to the site. In such cases even the site collection administrator also can’t add/edit content in the site.


To get the usage details of the site we use the method site.GetUsage(SPUsageReportType , SPUsagePeriodType ).

SPUsageReportType Enumeration

The SPUsageReportType enumeration specifies the type of information returned in a usage report for a SharePoint site.

The following table shows the members of the SPUsageReportType enumeration and a brief description

Name Description
browser The type of Web browser used to visit the SharePoint site. All usage data refers specifically to visits from referring URLs external to the site.
os The operating system used on the client computer. All usage data refers specifically to visits from referring URLs external to the site.
refUr External URLs through which users navigated to the SharePoint site.
url URLs of pages that are visited or of pages for lists that are updated. Discussions about a page are counted as hits on that page.
user Users who visited the site.

SPUsagePeriodType Enumeration

The SPUsagePeriodType enumeration specifies the time interval on which a usage report for a Web site is based.

The following table shows the members of the SPUsagePeriodType enumeration and a brief description

Name Description
day Returns usage information for each day during the past 31 days starting from the previous day
lastMonth Summarizes usage information for the last 31 days relative to the previous day

Below are details how we can access respective data.

Accessing User daily report

//Users who visited the site
DGUsers.DataSource = site.GetUsageData(SPUsageReportType.user, SPUsagePeriodType.day);

Accessing User monthly report

//Users who visited the site
DGUsers.DataSource = site.GetUsageData(SPUsageReportType.user, SPUsagePeriodType.lastMonth);

Accessing Browser daily report

//The type of browsers used to visit the site
DGBrowser.DataSource = site.GetUsageData(SPUsageReportType.browser, SPUsagePeriodType.day);

Accessing Browser monthly report

//The type of browsers used to visit the site
DGBrowser.DataSource = site.GetUsageData(SPUsageReportType.browser, SPUsagePeriodType.lastMonth);

Accessing Operating System daily report

//The Operating System used in client computer
DGOs.DataSource = site.GetUsageData(SPUsageReportType.os, SPUsagePeriodType.day);

Accessing Operating System monthly report

//The Operating System used in client computer
DGOs.DataSource = site.GetUsageData(SPUsageReportType.os, SPUsagePeriodType.lastMonth);

Accessing refUrl daily report

//External URL client used to navigate to SharePoint site
DGRefUrl.DataSource = site.GetUsageData(SPUsageReportType.refUrl, SPUsagePeriodType.day);

Accessing refUrl monthly report

//External URL client used to navigate to SharePoint site
DGRefUrl.DataSource = site.GetUsageData(SPUsageReportType.refUrl, SPUsagePeriodType.lastMonth);

Accessing url daily report

//URL’s of pages visited
UsageGrid.DataSource = site.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.day);

Accessing url monthly report

//URL’s of pages visited
UsageGrid.DataSource = site.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth);


When you create a workflow for a list or document library using SharePoint designer, you may find the workflow doesn’t start automatically. When you check the new item that you have created,  it will not have any workflow associated with it.

This scenario will rise after you install Windows SharePoint Services 3.0 Service Pack 1 (SP1).

The important thing you have to note here is that you could have added the item using system account. If you try adding the item with any other account it works fine.

To resolve this behavior, set the application pool account to use a different user account.

To set the application pool account to use a different user account, follow these steps:

  1. On the server that is running one of the products that is listed in the “Applies to” section, click Start, point to All Programs, point to Microsoft Office Server, and then click SharePoint 3.0 Central Administration.
  2. Click the Operations tab.
  3. Under Security Configuration, click Service Accounts.
  4. Click Web application pool, and then click Windows SharePoint Services Web Application in the Web service box.
  5. In the Application pool box, click the application pool that you want to change.
  6. Under Select an account for this component, click Configurable, and then type the user name and the password for the different user account.

You can find the KB article related to this issue here..