Archive for the 'SharePoint/MOSS' Category

Don’t… Forget… the Admin.. Service… Jobs……..!

Seeing weird behaviour in your SharePoint installation after making changes and just can’t explain it?  Have you tried executing the admin service jobs yet???

For the unaware, that means running this from your command line:

stsadm -o execadmsvcjobs

A lot of times, this will make SharePoint finally “notice” something you’ve changed.  I forgot that lesson until I strugged today with getting it to notice a change in the FieldRef nodes in one of my content types, no matter how many times I monkeyed around with it.

So, in summary, always try the service jobs!  You never know when they just might fix your #%*()#$%ing issue and save you a bunch of time.

Until the next time…

Advertisements

Make your custom web service work on a SharePoint server

So I had written a small web service that uses the SharePoint APIs (the DLLs, not the SP  web services) to update list items on a particular list.  In my dev environment inside visual studio, it works great using ctrl-F5 or F5 to start it.  When I went to deploy it to a shared SharePoint staging environment, I didn’t know how to set it up.  Initially I tried just copying it into inetpub\wwwroot\myWS\ and marking the folder as an application in IIS, naively thinking that was sufficient.  But since this is SharePoint, of course it just isn’t!

I did some googling and found a walkthrough from Microsoft: http://msdn.microsoft.com/en-us/library/ms464040%28office.12%29.aspx (or for 2010: http://msdn.microsoft.com/en-us/library/ms464040(office.14).aspx).  At first I thought it seemed odd to have to install my web service to the 12\ISAPI folder where it would get mapped to http://myserver/_vti_bin/, and to have to convert my static wsdl and disco files (generated by VS) to .aspx pages to have them handle the correct path, etc., etc.  I resisted the idea and went home for the day.

The next day I decided to try the walkthrough and sure enough it works great.  So I thought I should jot this down for when I run into it again.  Maybe it will help you some day, too.

EDIT: this link may also prove helpful: http://www.codeproject.com/KB/sharepoint/MOSS4Devs-08-WebServices.aspx

Code block not allowed in your SharePoint Master Page error

"Code blocks are not allowed in this file"

Code blocks are not allowed in this file

I’m posting this now because I just ran into it for a second time, but had completely forgotten what the issue was when I googled it the first time.  So I’m posting it here for my convenience, mostly!

If you suddenly start getting an exception from SharePoint stating that code blocks aren’t allowed in your master page, you need to add a new <PageParserPath> element to web.config to allow the code.  Why this starts happening all of a sudden when the same code block existed in the path previously without the exception, I will never understand.  But the point is, follow the directions in one of these blog postings to resolve it:

http://mystepstones.wordpress.com/2009/02/13/code-blocks-are-not-allowed-in-this-file/

http://svengillis.blogspot.com/2008/03/code-block-are-not-allowed-in-this-file.html

http://dotnetdeveloper.co.uk/blogs/sharepoint/archive/2008/10/10/code-blocks-are-not-allowed-in-this-file.aspx

Can’t find the Site Directory template when creating a site in SharePoint 2007?

Neither could I.  The problem was that I didn’t have the “Office SharePoint Server Enterprise Site Features” site feature and “Office SharePoint Server Enterprise Site Collection Feature” site collection features activated.  Once I activated them, I got the Site Directory as an option as expected.

(Note: if you still can’t see the template after activating those features, try navigating to http://<your_site_root>>/_Layouts/AreaTemplateSettings.aspx and adding the Site Directory template to the available list, then try again.)

SharePoint 2007 Publsihing Site Stops Recognizing Custom Landing Page

Greetings!  It’s been a while since I’ve posted anything, but I’m hoping this may prove helpful to someone somewhere sometime.

Recently myself and a few other SharePoint team members at my site rolled a number of new and updated features into production.  This was a long and grueling affair, and part of the reason was we spent a few hours on this issue I’m about to describe.  We never found anyone describe this problem (or solution) through googling, so I’m either it’s hard to find, or nobody has talked about it.

We have a custom landing page layout and landing page layout content type that we use on a collaboration site.  A previous version was in production and worked fine.  Part of our big production rollout the other day was to update both the landing page layout and content type.  We deployed these two features in our usual way: by updating the 12-hive, de-activating, install -force’ing, and [re]activating the features through stsadm on the command line.  The landing page content type activated fine, the landing page page layout activated fine, but we have a 3rd feature which is for the landing page itself (to dynamically create it through some code in FeatureActivated), and it was throwing an index-out-of-bounds exception when we tried to activate it.

Looking at the exception, and the FeatureActivated code, we narrowed it down to what appeared to this block of code:

SPContentTypeId contentTypeId = new SPContentTypeId(welcomePageLayoutContentTypeId);
PageLayout[] layouts = pubWeb.GetAvailablePageLayouts(contentTypeId);
PageLayout welcomePageLayout = layouts[0];
page = pubWeb.GetPublishingPages().Add(dcsLandingPageFileName, welcomePageLayout);

Specifically, to the layouts[0].  This seemed to indicate that GetAvailablePageLayouts was not returning our custom landing page layout associated with our custom landing page content type.

We spent some time re-deploying all 3 features again with no success at that last step.  We made sure that the content type looked up to date, that the Master Pages and Page Layouts gallery had the most recent version of the page layout, that the page layout was correctly associated with the landing page content type, that we had deleted the old landing page from the Pages library, etc., etc.   Nothing we tried helped.

Eventually through some googling, another member of my team found this installable feature that lets you do a number of things, among them to enumerate all the available page layouts to the command line.  The feature is described here http://stsadm.blogspot.com/2007/08/enumerate-available-page-layouts.html.

Once we had installed and ran that feature, we discovered that our custom landing page layout was not showing up in the list.  We re-verified the the site settings that the page layout was in the gallery and was associated to the page layout content type, and that the content type was installed correctly, etc., but nothing seemed to help.

Then we finally had a break-through:  looking at the enumerated available page layouts listing from the stsadm tool, we noticed that not only was our custom page layout not showing, but a number of other page layouts were missing, all of which were out of the box SharePoint Publishing content types!  We determined this by comparing the enmerated page layouts list on our “broken” site vs. the list on another site using the same lading page that was functioning correctly.

This lead us to the Site Collection Features and Site Features pages to verify that publishing was enabled.  It was.  We were further stumped.  On a whim, we decided to try de-activating both features and re-activating them.  Guess what–this solved our problem!

So even though publishing appeared to be enabled, somehow, bizarrely, it was actually broken.  Flipping the switch on and off resolved this, after a few hours of face-palming and much stress.  I hope this tale may help you if you ever run into this.  It’s worth a shot!

Today’s Sharepoint/MOSS Roundup

SharePoint logo

SharePoint logo

…courtesy of @sqlbell.  You’ll notice a Workflow and Debugging theme…

Troubleshooting SharePoint .NET Workflows:

http://sharepointdevwiki.com/display/public/Troubleshooting+SharePoint+.NET+Workflows

VERY detailed instructions for creating a MOSS 2007 VPC Image:

http://www.pptspaces.com/sharepointreporterblog/Lists/Posts/Post.aspx?ID=28

How to debug a Workflow with VS Debugger:

http://blogs.msdn.com/philloth/archive/2009/01/19/how-to-debug-a-workflow-with-visual-studio.aspx

Stop VS Crashing When Using Attach Pprocess to Debug a SP Workflow:

http://www.zedthehead.com/index.php/2009/sharepoint/visual-studio-crashes-when-trying-to-attach-w3wp-process-to-debugger/

Properly Populating and Retrieving SharePoint Field Data:

http://corypeters.net/2008/07/properly-populating-and-retrieving-sharepoint-field-data/


Scott’s recent tweets…