in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Dave Wollerman's SharePoint Blog

I use this blog to share information with the community plus also as a repository for reference material on unique situations that I have come across.

View Dave Wollerman's profile on LinkedIn      Sogeti Logo

April 2008 - Posts

  • Using a Site Template (STP File) to create a site collection

    Site templates can be very useful for an easy custom starting point for common site usage. Site templates can be saved from any site (except publishing sites for some reason... Smile ). These site templates are stored into the site collections site template gallery as STP files. Once they are created a user with permissions can create sites within that site collection based on that template.

    What happens if you want to use that site template to create a top level site in a site collection. When creating a site collection you are only shown available templates that are global to the entire farm. If you want to use your custom site template when creating a site collection follow the instructions below...

    1. Create your site template (I assume you already know how to do this, but if not go to the site settings of any web and select "Save Site as Template")
    2. Navigate to the site template gallery where the site template is saved. This will be under Site Settings -> Galleries -> Site Template Gallery.
    3. Save the custom site template to the SharePoint server local drive.
    4. Remote Desktop into the SharePoint server where the STP file has been saved, and open a command prompt.
    5. Use STSADM to upload the template into the global templates list by using the STSADM -o AddTemplate command. For help with the AddTemplate command use STSADM -help addtemplate.

    obviously make sure you either specify the path to stsadm in the command line, or as part of the server's PATH variable. Also, if you are not in the folder where the STP file exisits, you will have to specify the full path to the STP file as well. Remember if there are spaces anywhere in the path you will have to surround the full path with double quotes.

  • Upgrade Solution Package with a Feature Reciever after the feature has already been deployed.

    We all know by now you can deploy features using a SharePoint solution package. This is a great addition for SharePoint developers as it easily allows us to quickly and efficently upgrade our customizations, plus it helps keep everything organized.

    One thing I ran across was after deploying a solution that included a feature, I realized that I wanted to create a feature receiver for that feature to run some code upon activation and deactivation. I noticed that the feature is partially updated when running a solution upgrade. This means that the feature.xml is updated to look for the specified feature receiver class, but when you activate the feature after the upgrade you receive and error saying the receiver couldn't run.

    My resolution that seemed to work for me was to reinstall the feature manually. I ran the following command and I was then able to activate the feature as normal and have the feature receiver kick off as well.

    stsadm -o installfeature -name <featurename> -force

  • Logging exceptions to the SharePoint Trace Log (Diagnostic Logging)

    Microsoft has a great piece of example code that you can copy and paste into your solution and start using on how to write to the SharePoint trace log. these are the log files that get created from setting up "Diagnostic Logging" under Central Administration -> Operations. I have used it in the past and it works pretty well.

    http://msdn2.microsoft.com/en-us/library/aa979590.aspx

     

  • SharePoint Solution Doesn't Deploy to GAC and Errors

    This is a wierd issue I recently ran across. I was using remote debugging and I needed to copy over the PDB symbols file to the GAC. I used the command line to copy the file over to the appropiate location. I ran the command line down to the folder I needed to copy to in the GAC and left it open since I didn't want to write that out everytime I needed to update it. (I know I'm lazy, I should of and ended up writing a BAT file to do it for me).

    With it left open I noticed that when I updated my solution it would fail and not deploy my assembly to the GAC. I realized that this was because I had the command window open to that folder. I didn't think that it would matter since it wasn't doing anything but sitting there. I closed the command window and re-deployed to my web applications and everything was fine after that.

  • Remote Debugging GAC'd Assemblies in SharePoint

    Like alot of people in the SharePoint development community I have been using a VPC to do debugging of code through SharePoint. I don't really like this because for one, running an enterprise level application plus visual studio with a laptop and 2GB of memory is very time consuming and can get frustrating at times.

    With this said, I recently decided to look into remote debugging my SharePoint code from a client machine to the SharePoint server. I still didn't want to load up visual studio on the server either. Below are the steps that I took to accomplish remote debugging my SharePoint code.

    1. Created a share on my client machine on my C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger folder.
    2. Then I remoted into the SharePoint server and mapped a drive to connect to the share on my client machine.
    3. Open the mapped drive on the server and navigate down the folders to x86\msvsmon.exe and run it on the server through the share.
    4. Once the remote debug monitor is running. Click on tools -> permissions to give the account your logged in as permissions to debug.
    5. You will also need to deploy the PDB file generated by visual studio when it creates your assembly to the GAC as well on the server. You will need to copy via the command line utility or map a drive to it since it is not available through the folder structure in windows. the folder you have to copy the PDB file to is c:\windows\assembly\gac_msil\<assemblyname>\<version>__<public key token>. You will need to replace the three place holders (identified with <>) with the appropiate names for your assembly. Once the PDB file is copied over to that folder location, you are ready to attach and debug
    6. In visual studio, select attach to process from the debug menu
    7. In the "Qualifier" text box enter the netbios name of the server that the remote debugging monitor is running. It should refresh the screen and connect to the remote debugging session on the server. You can verify by going to the server and looking at the remote debugging monitor to see who is connected.
    8. I choose to change the types of code I will be attaching to. I used the "select..." button to remove TSQL from the list since it was causing issues and I wasn't debugging SQL anyway.
    9. Select your process and happy debugging.

    Good Luck!

     

  • Navigation in SharePoint Team Site w/ Publishing Infrastructure Activated

    I recently was looking into programmatically setting up navigation in publishing sites and came across a scenario I felt I should share with the community so everyone is aware of it, and to see if there is any help with a workaround.

    The scenario is that when a normal team site is created it uses the basic WSS navigation structure. This structure can be accessed from the SPWeb.Navigation class. In the site collection where the Team site is located, an administrator can activate the MOSS Publishing Infrastructure under the site collection features area, which will change the Team site navigation to the publishing navigation structure. This is not a big deal since it allows you to have more control over your navigation without all the publishing aspects being turned on within the Team site.

    The problem occurs when trying to access this navigation programmatically. You see from the browser that the navigation is using the publishing structure, but you don't have access to the navigation programmatically using the PublishingWeb.Navigation class since the "Web" is not a "PublishingWeb". To make the web a publishingweb you need to activate the publishing feature at the web scope. The catch-22 occurs when you don't want the Team site to have publishing turned on at the web scope, but the publishing infrastructure is turned on at the site scope.

    I haven't found a way to manipulate the publishing navigation pieces without having the publishing feature activates at the web scope. If anyone has any tips that would be very much appreciated, but for now the work around is to either configure it manually, or activate the publishing feature at the web scope.


Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts