nik codes

Archive for the category “SharePoint”

SharePoint ClientSide Extensions

I had a bright idea for a fairly simple SharePoint feature a few months ago when one of my students showed me the extensive work they had done using JavaScript via the Content Editor Web Part.

My idea was to allow for a simple way to "get JavaScript frameworks on the page".  This would allow non-technical users to simply copy and paste various little JavaScript widgits from around the web and place them on their SharePoint page.

I began working on the feature slowly, mostly during commercial breaks and other short bursts of free time. I finished the simple idea rather quickly – but then I let the scope creep monster attack.  I kept adding more and more features UNTIL…

Recently when other blogger’s implemented very similar ideas. Most notably:

So I decided to stop making small tweaks and additions and get this code out into the wild, it obviously has a need.

With that said, I’d like to introduce you to the

SharePoint ClientSide Extensions

SharePoint ClientSide Extensions is a simple SP solution. Once you add the solution, a site feature is provisioned which, when activated, gives you this screen in the Look and Feel column of the site administrator:

settings

You can add any of the above JavaScript libraries to your site, and then, via JavaScript in a Content Editor Web Part, access them.  This gives users instant access to the various widgits and UI components that these libraries provide.

For times sake I haven’t whipped up an example of how you might use this, but I will post that soon. Until then feel free to grab the WSP and play around with it.

I also want to point out that Jan and Gunnar have done a great job and I wanted to acknowledge their work.

– By

Advertisements

FireFox, meet MSDN

I find myself using FireFox all the time.  I never thought I’d leave IE, but since I develop web applications almost all day long, FireFox’s extensions are invaluable to me.

IE does have a few extensions, but they come nowhere close to FireBug

Anyway’s, since I’m in FireFox, doing web development, I would like to look up web development documentation right in FireFox.

This led me to create my first browser extension – the MSDN Search plugin for FireFox! 

msdnFirefox

It works exactly how you’d think it would.  It is almost always faster than opening up the .Net or WSS SDK documentation as well.  Please give it a try and let me know what you think.

To use it simply extract msdn.zip and place the two files in your searchplugins folder, usually located at: C:\Program Files\Mozilla Firefox\searchplugins

Once you restart FireFox, MSDN should be available from your search box. 

For those of you who don’t find yourself using the search box that often, here are a few tips to get you up to speed:

  • Ctrl + E selects the search box
  • Ctrl +Up or Ctrl + Down cycles through all your installed search engines
  • Alt + Enter will open up the search results within a new tab

Leave feedback in the comments!

Download MSDN.zip

– By

SharePoint Designer Soap Server Error

The other day in SharePoint Designer and when I tried to open up a page I was faced with a menacing error:

soap:ServerServer was unable to process request. —> A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered as safe on this site. You may not be able to open this page in an HTML editor that is compatible with Microsoft Windows SharePoint Services, such as Microsoft Office SharePoint Designer. To fix this page, contact the site administrator to have the Web Part or Web Form Control configured as safe. You can also remove the Web Part or Web Form Control from the page by using the Web Parts Maintenance Page. If you have the necessary permissions, you can use this page to disable Web Parts temporarily or remove personal settings. For more information, contact your site administrator.

It looked like this:

 spdError

I did a little browsing is it turns out the problem was with a web part that had error-ed out.  When the error occurred I closed the web part, never to be seen again.  Closing the web part is what led to this problem.

Notice in SharePoint you close web parts – meaning that they are technically still on the page, just in a closed state.  What I wanted to do is “delete” the web part instance from the page.

Turns out there is a simple mode you can put pages into to do just that!  Simple append you URL with a variable named contents and its value equal to 1.  IE:

YourURL?contents=1

This will put the page into the Maintenance mode mentioned in the error.  From this page you can completely remove web parts from their pages.

webPartPageMaintenance

Its a good idea to check this every once and a while, because closed, unused web parts can still consume resources and slow down page loads.

– By

SharePoint Tools

Today is my last day at my current company.  I wanted to take a moment and create a list of all the great SharePoint tools I use here – in case I need them in the future.

I really recommend these tools to anyone doing WSS 3.0 development.

Application Pool Manager – System tray tool for restarting individual application pools.

Application Pool Manager 

Debugging Tools for Windows – My main use for this is to store .PDB files in a symbol server.  This makes debugging in SharePoint much easier.

SharePoint Best Practices Analyzer – This is great for checking your SharePoint installation and configuration.  Like all the other “practice analyzers” that Microsoft has put out.

SharePoint Solution Installer – This is the best way to deploy a solution to a client.  No command line nonsense for your client to worry about.

Solution Installer

SharePoint Manager 2007 – GUI to dig into the SharePoint DOM.  Makes it easy to quickly find and even set properties of your farm.

SharePoint Manager 2007

StsAdmWin – GUI for discovering available stsadm commands.  Even finds custom commands!  Great for beginners.

Visual Studio Extensions – Not completely necessary in my opinion, but nice to have.

WSPBuilder – Invaluable!  Builds your wsp files for you – no more messing with ddf and manifest files!

WSS SDK – Who doesn’t need documentation?  This is everything you want to know about WSS.

– By

Ports Synced

At work we have many SharePoint environments: each developer has their own, plus staging and production.

I went on a small crusade to standardize and sync the port which each environment’s Central Administration site used.  I thought this might be difficult to track down and make all the changes, but it wasn’t stsadm to the rescue.

Just try this:

stsadm -o setadminport -port 100

– By

Setting Up IIS Application Pools

Today I attempted to change the identity information for the application pool running my main SharePoint site.

I entered a valid username and password and recycled the application pool – but when I visited my site I got a big error message:

Service Unavailable

I looked in the system log and found this message:

The identity of application pool, ‘SharePoint – 80’ is invalid.  If it remains invalid when the first request for the application pool is processed, the application pool will be disabled.  The data field contains the error number.

The event ID for the error was 1021 and the source was W3SVC. To fix this, make sure you are using the proper username and password, and – this is the part I didn’t know about – make sure the user is a member of the ISS_WPG group on the SharePoint server.  When you create an application pool through SharePoint’s Central Administration site SharePoint adds the user to that group for you, so you should only have to worry about this if you are changing the identity after SharePoint has created it.iiswpg

– By

Debugging WSS

Last time I covered how to show full debugging information in WSS by editing the web.config.  That’s a great tip to easily peer into WSS, but it’s no step debugging.

To get step debugging there are a few simple things that you need to do.

1. Attach to the proper process:

Depending on what you are trying to debug – you need to attach Visual Studio to the proper process.  For WSS development, most of the time you will want to attach to w3wp.exe.  Its the IIS worker process and will allow you to debug web parts, feature receivers, etc.

Attaching to w3wp.exe is easy in Visual Studio: Select Debug > Attach to Process find w3wp.exe in the list and press Attach.

You may notice more than one instance of w3wp.exe running – which is normal since each IIS Application Pool runs in its own worker process.  To figure out which process you need to attach to you can run iisapp from the command line.

The first time you run iisapp you will see an alert box that says “This script does not work with WScript.“:

iisapp1

Just press OK and then Yes to the next prompt.

 iisapp2

This will give you the success message “Successfully registered CScript” at which point you are good to run iisapp.

iisapp3

To be sure you connected to the proper process you can press  Ctrl + D, M to bring up the Modules window.  This is a list of all assemblies that Visual Studio is monitoring.  Make sure the assembly you want to debug is in this list.

Side Note:
To debug SPJobDefinition’s as they run, you must attach to the owstimer.exe process.

To make all this attaching even easier, Andrew Connell has a nice little macro that will automatically attach to these processes for you.

2. Load Symbols

Visual Studio needs access to .PDB files to give you the best debugging experience.  The problem is that most of the time when you are working with WSS you have your assembly loaded in the GAC and aren’t too sure where the .PDB file is, or where it should go.

The best way around this problem is to use a symbol server.

A symbol server is nothing more than a folder on your machine that has all the .PDB files you need in it.  I recommend that you make a shared folder on your build server specifically for this purpose – so that when you do a build, you can easily automate putting PDB’s in their proper place.

Once you have created a folder where you plan to store your PDB files you need to populate it using a program named symstore.exe which comes with the Debugging tools for Windows.

Once you have installed the tools simply run:

symstore add /f “Path/To/*.PDB” /r /s “Path/To/Shared/Folder” /t “Product Name

and your .PDB’s are now on the Symbol Server!

Note:
I’ve added the path to symstore.exe to my PATH environment variable.

I’ve added that command to my post-build script in Visual Studio so that the newest version of the .PDB’s are always available to me as I debug.  (Although it’s probably better to have your build server do this part.)

To make it a little simpler to manage your symbol server be sure to check out PowerShell Symbol Store – a nice GUI for managing symbol servers plus PowerShell scripts to help you along.

Finally once you have your Symbol Server setup you have to tell Visual Studio where it is.  Select Tools > Options > Debugging > Symbols and add the path.

Now attach to the proper process, browse around your SharePoint site and anytime you execute code with a breakpoint on it Visual Studio will begin to flash and you will be debugging!

WSS 3.0 Debugging

This is a rehash of info that’s already all over the web – but for me to find quickly I’ll repeat:

To enable debugging in WSS 3.0 update C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config so that these attributes are set as seen below.

<configuration>
	<SharePoint>
		<SafeMode CallStack="true">
	</SharePoint>
	<system.web>
		<customErrors mode="Off" />
		<compilation batch="true" debug="true">
	</system.web>
</configuration>

DO NOT REPLACE YOUR WEB.CONFIG WITH THE ABOVE FILE.  Simply change the attributes in your file to match the ones listed above.

Post Navigation