SharePoint STSADM command line error

Something that has bitten me a couple of times. If you are trying to copy an STSADM command line from a web page and paste it directly to the command prompt box on a SharePoint server. Don’t.

It doesn’t work because of something to do with pasting HTML style text into a DOS text prompt.

Re-type the command line or paste to a text editor as unformatted text and remove any formatting before copying and pasting from the text editor to the command line.

SharePoint error: Value does not fall within the expected range. at Microsoft.SharePoint.SPFolderCollection.get_Item

In a day plagued with SharePoint errors, this one was a minor issue.

Value does not fall within the expected range.   at Microsoft.SharePoint.SPFolderCollection.get_Item(String urlOfFolder)
at Microsoft.SharePoint.Publishing.CommonUtilities.GetDocLibByUrl(SPWeb web, String webRelativeUrl)

This arose because the site that I was trying to Activate SharePoint Publishing service was within a Site Collection that had the service disabled. Enabling at the collection level, then allowed enabling at the site level.

SharePoint error: The site is not valid. The ‘Pages’ document library is missing.

I came up with this error when I manually created a ‘Pages’ library and was trying to create New page in the library.

The site is not valid. The ‘Pages’ document library is missing.   at Microsoft.SharePoint.Publishing.PublishingWeb.get_PagesList()
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BaseP….

…agesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The issue is that the ‘Pages’ library is created automagically by a Team Site template but not with a Blank Site template. My quickie solution was to recreate the new site that I was just starting and use the Team Site template instead of the Blank template and just remove the other components that I did not need.

I am sure there is a better way but I’ll look for it later. Expedience is, as always, the driver.