Beyond Web Logs

Discuss technology, web development, networks and more ...

Recent posts

Tags

First time here? At BeyondWebLogs we discuss technology, web development, personal development, networks and more. You can subscribe to the RSS feed so that you keep up to date with the latest content. Now, on with the regular content...

3 Sharepoint Developer's Tips

Tip #1: Add Command Line Shortcut to "12 Hive"
I'm not talking about creating a shortcut to the 12 Hive (the directory where just about everything WSS v3 is installed) on your desktop/Quick Launch. Like most people, I create a "12" toolbar on my Start Menu (as shown in the image to the right)... not talking about that either.

When you're in a command prompt, sometimes you need to navigate to the 12 Hive directory. But no one wants to type the directory path to c:\Program Files\Common Files\Microsoft Shared\web server extensions\12. Wouldn't it be easier if you could just type the following to get there?

c:\>cd\
c:\>cd %12hive%
c:\Program Files\Common Files\Microsoft Shared\web server extensions\12

I'd sure say it is! The other thing is I almost always want to be within a Visual Studio Command Prompt to have easy access to things like SN.EXE and GACUTIL.EXE. A VS Command Prompt is nothing more than a simple batch file. I've created my own batch file that executes the VS Command Prompt batch file and sets the %12HIVE% variable to the 12 Hive directory. Here's how:

  1. Create a new file called SharePointCommandPrompt.cmd and insert the following text in it (if you're on a 64 bit system, you'll want to make the appropriate changes):

    @echo off
    echo Setting 12HIVE environment variable.
    set 12HIVE="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12"
    "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86

  2. After saving the file, create a new shortcut with the following target:

    %comspec% /k ""c:\[Path To The File You Just Created]\SharePointCommandPrompt.cmd""

  3. To put a cherry on top, drag the shortcut onto your Quick Launch toolbar... should work like a champ!

To try it out, click the shortcut and type CD %12HIVE% at the command prompt. You should change directories to the root of the 12 Hive.

12HiveCommandPrompt

Tip #2: Access STSADM.EXE From any Directory in a Command Prompt
STSADM.EXE, the main administration utility for SharePoint, is still just a command line utility. You'll find it in %12HIVE%\BIN. To run it, you have to actually be in that directory... an inconvenience to me! Instead, add the directory to the PATH environment variable so you can type STSADM.EXE from any directory on your system. To do this:

  1. Start -> All Programs -> Control Panel -> System
  2. On the Advanced tab, click the Environment Variables button.
  3. Select the variable Path and click the Edit button.
  4. Add the following to the end of the Variable value field (don't forget the semicolon... the Path environment variable is a semicolon delimited string of directories):
    ;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
  5. OK out of all the dialogs.

Next time your system restarts, you'll be able to type STSADM.EXE at a command prompt from any directory on your system.

Tip #3: Recycle Application Pools, not IIS (I got this tip from my colleague Todd Bleeker)
So many things in SharePoint require you to recycle the the W3WP.EXE process running SharePoint in order for certain changes to be picked up. So many people think this means recycling IIS by typing IISRESET. But it takes so long for IIS to recycle!

Did you know you don't have to recycle IIS most of the time, just the application pool your site is running within? Yup! For development purposes, I run all my SharePoint sites off the same app pool. I know, not the most secure, but each app pool consumes roughly 100MB of memory so why have a ton of them floating around in a virtual machine when memory is precious!

Instead of recycling IIS, I create a shortcut that I add to my Quick Launch that recycles the app pool all my sites run under. To do this, create a new shortcut on your desktop and enter the following target:
%windir%\system32\cscript.exe c:\windows\system32\iisapp.vbs /a "[Name of your App Pool]" /r

Then drag the shortcut onto your Quick Launch toolbar. Click it and watch how fast an app pool is recycled compared to IIS!

 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Technology
Posted by Waqas on Monday, July 30, 2007 8:49 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Creating Development Environment for SharePoint

Before developers started working on SharePoint object model they must perform the following options so that he can easily debug application on the Sharepoint, set the security trust settings and enable the exact exceptions and call stacks to be received

Modify ASP.NET debug settings.

1. In Windows Explorer, browse to the root folder of the

Windows SharePoint Services extended virtual server

C:\InetPub\wwwroot\.

2. Open web.config with Notepad.

3. Find the <compilation> element.

4. Change the “debug” attribute to true (i.e. <compilation batch=”false” debug=”true” />.)

2. Modify Visual Studio CAS security settings to allow Debugging.

1. Continue to modify the web.config file.

2. In the Web.config file, search for the <trust> element.

3. Modify the “level” attribute to WSS_Medium (i.e. <trustlevel=”WSS_Medium” originUrl=”" />.)

3. Enable the CallStack

Attribute to receive a call stack and all exception messages when an exception occurs.

1. Continue to modify the Web.config file.

2. In the Web.config file, search for the <SafeMode> element within the <SharePoint> element.

3. Modify the “CallStack” attribute to true (i.e. <SafeMode MaxControls=“50” CallStack=“true”/>.)

4. Save and close the file.

5. Execute Start -> Run -> iisreset

6. Browse to http://localhost to verify that the site still functions (if the changes are incorrect you will get a parser error.)

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Technology
Posted by Waqas on Monday, July 30, 2007 8:47 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Unoffical Google Shop

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by Waqas on Monday, July 30, 2007 8:24 PM
Permalink | Comments (0) | Post RSSRSS comment feed