Tag Archives: SharePoint 2010

SP2010 Sandbox Development Tip

If you want to make sure that you aren’t using any of the restricted APIs before you deploy your solution to a sandbox environment, manually reference your project against:

[SharePoint Root]UserCodeassembliesMicrosoft.SharePoint.dll  

If your code compiles, then you’re pretty safe!

NEVER DEPLOY code with this Microsoft.SharePoint.dll reference, instead reference the Microsoft.SharePoint.dll in

[SharePoint Root]ISAPI folder.

From the SharePoint 2010 book I’m reviewing

Debugging SP2010 Sandbox Code – Short and Sweet

If you find yourself in a situation when you need to attach to a process from VS 2010, to debug,  and you’re code is running in a “sandbox”.  You need to attach to the process SPUserCodeService.exe, not w3wp.exe.

SharePoint 2010 hosts sandbox code in a secure service – the user code service – so it can monitor resources and make sure the user’s code isn’t performing any action that could compromise the platform.

From the SharePoint 2010 book I’m reviewing

SP2010 Developer Dashboard

The SP2010 Developer Dashboard allows developers to review object model calls, database queries, web part events – and the timings for these various happenings.

The following code enables the dashboard:

SPPerformanceMonitor SPPerfMon;
SPPerfMon = SPFarm.Local.PerformanceMonitor;
SPPerfMon.DeveloperDashboardLevel = SPPerformanceMonitoringLevel.On;
SPPerfMon.Update();

The following code turns it off again:

SPPerformanceMonitor SPPerfMon;
SPPerfMon = SPFarm.Local.PerformanceMonitor;
SPPerfMon.DeveloperDashboardLevel = SPPerformanceMonitoringLevel.Off;
SPPerfMon.Update();

Development Setup for SP2010

Some important points to remember when developing against SP2010:

  • Make sure your Visual Studio project is set up for .NET 3.5, not .NET 4.0
  • Run Visual Studio as an Administrator to load debugging symbols
  • Make sure your project is set to compile for Any CPU or x64 (not x86 by default), otherwise your code will throw a FileNotFoundException

From the SharePoint 2010 book I’m reviewing

Provision 2010 Farm without the Mess

Anyone who has created a new SP2010 Farm using the SharePoint Technologies Configuration Wizard will know that it makes a huge mess of SQL server, littering new databases with GUID extensions.

Those of you who have anal tendencies, like me, can sleep at night with nice clean database names with a script as follows:

Note: I am working on a script that will create Service Applications, which also like to create many GUID database instances.

@echo off

if "%1" == "" goto usage
if "%2" == "" goto usage

pushd C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14BIN
echo Creating New Farm Instance
psconfig.exe -cmd configdb -create -server %1 -database %2_SharePoint_Config -user DEVMOSS_Farm -password Sharepoint3 -passphrase Sharepoint3 -admincontentdatabase %2_SharePoint_Admin_Content

echo Creating Central Admin Site
psconfig.exe -cmd adminvs -provision -port 8000 -windowsauthprovider onlyusentlm

echo Installing Services
psconfig.exe -cmd services install

echo Securing Resources
psconfig.exe -cmd secureresources

echo Starting Search Service
stsadm.exe -o osearch -action start -role Index -farmcontactemail support@portalsolutions.net -farmperformancelevel maximum -farmserviceaccount "DEVMOSS_Farm" -farmservicepassword Sharepoint3

echo Starting WSS Search Service
stsadm.exe -o spsearch -action start -farmserviceaccount DEVMOSS_Farm -farmservicepassword Sharepoint3 -farmcontentaccessaccount DEVMOSS_Search -farmcontentaccesspassword Sharepoint3 -databaseserver %1 -databasename %2_WSS_App_Search

echo Installing Feature
psconfig.exe -cmd installfeatures

echo Installing Health Rules
psconfig.exe -cmd InstallHealthRules

popd
goto end

:usage
echo "SP2010-Provision.bat <SQLServer> <Project Acronym>"

:end

SharePoint 2010 Posts Coming

image

It’s been quiet on my blog for some time, the usual excuses blah blah.  The good news is that I intend to post plenty about SharePoint Server 2010, which was recently released to partners as a private beta. 

I am currently honoring my NDA agreement with Microsoft, so no posts until the beta goes public later in the year, but that’s not to say I won’t be busy writing in the background ready for the announcement date.

Watch my blog for more details…