Andrew Connell [MVP MOSS]
1418 Posts |  40 Articles |  3755 Comments
.NET  |  MCMS  |  SharePoint  |  Office System
SharePoint Quick Links
Article Categories
Archives
Post Categories


Add to Technorati Favorites

Windows SharePoint Services (WSS) v3 includes a command line utility for administrators that allows you to perform numerous actions against your WSS v3 or Office SharePoint Server (MOSS) 2007 implementation. This utility, STSADM.EXE can be found in the [...]\12\BIN\ directory. The new version of STSADM.EXE includes the capability to add your own custom commands. This is a great vehicle for implementing your own custom administrative utilities instead of writing a separate command line or WinForm application to perform the same process.

Interested in building your own custom commands for STSADM.EXE? Check out a post by Tony Bierman on the SharePoint Solutions Team Blog that includes a great how to on this topic: Extending Stsadm.exe with Custom Commands using the ISPStsadmCommand Interface.

In the process of developing a Publishing site (aka: WCM site) in MOSS 2007, I've been building a few utilities that have helped me in accomplishing my goal, and I've decided to share these. This page contains my custom STSADM.EXE commands I've written for Web Content Management (WCM) developers. I'll use this page to serve as my documentation, making available the latest build of my custom commands, etc.

If you wish to be notified when my STSADM.EXE WCM custom commands are updated, please subscribe to my blog as I'll post updates there.

Version History

» Click here for a detailed change log.

Installation Instructions

I've made the installation as painless as possible. Creating custom commands for STSADM.EXE involves two things:

  1. Create a strongly named assembly that implements the ISPStsadmCommand interface and deploying this assembly to the GAC.
  2. Create an XML file containing a manifest of all the custom commands and a pointer to the assembly that contains the implementation. This XML file is then copied to the [...]\12\CONFIG\ directory.

With the v0.8.7.1029 release, installation is now a piece of cake. The entire solution is provided as a WSS solution package. Simply add the solution using STSADM as follows (assuming the WSP is in the root of C:\):

c:\[..]\stsadm.exe -o addsolution -filename c:\AndrewConnell.SharePoint.StsadmWcmCommands.wsp

With it added to the solution store, deploy it by going to Central Administration » Operations » Solution Management and deploy the solution.

Need to uninstall? Simply retract the solution and remove it using the functions on the Solution Management page.

List of Commands in AC's STSADM.EXE WCM Custom Commands Suite

  • PublishAllItems [details here]
    When developing a Publishing Site in MOSS 2007, you're bound to have countless pages, page layouts, master pages, images, JavaScript files... and so many more types of files that are in some state of moderation flux. Of course, this traditionally isn't a problem in a production environment... but you're sure to hit it in development, UAT, or QA in building a new site... maybe even working on an existing site! The command PublishAllItems will traverse a site collection, check-in any checked-out items, approve any pending approval, and publish all items.
  • GenSiteColumnsXml [details here]
    The process of building an elements file for a WSS v3 Feature that creates new site columns upon activation is tedious and problematic due to the lack of a rich debugging environment... even when you can use the WSS v3 XML Schema (WSS.XSD). Instead, build the site columns using the browser interface and use this command to generate the elements XML file for you! Will it give you exactly what you want? Maybe (likely) not, but it sure is easier to have a file you can tweak and prune rather than building one from scratch... not to mention a faster development experience.
  • GenContentTypesXml [details here]
    Similar to site columns, the process of building an elements file for a WSS v3 Feature that creates new content types upon activation is tedious and problematic due to the lack of a rich debugging environment... even when you can use the WSS v3 XML Schema (WSS.XSD). Instead, build the content types using the browser interface and use this command to generate the elements XML file for you! Will it give you exactly what you want? Maybe (likely) not, but it sure is easier to have a file you can tweak and prune rather than building one from scratch... not to mention a faster development experience.

AC's STSADM.EXE WCM Custom Command Details

Command: PublishAllItems

Regardless of the moderation state of any item within the specified list, the PublishAllItems command will publish any item that's checked-out, pending approval, or pending publishing.

The command has two required parameters and two optional parameters:

Argument Description
-url <url> Required. The URL of any site within a site collection.*
-list <list name> Required. Name of the list containing items to publish.
-includeSubSites Optional. If specified, the command will perform the same action on all lists of the same name in all subsites.
-displayProgress Optional. If specified, all check-in, approval, and publishing actions are logged to the command window. This makes it easier to see what is going on and the progress of the action. This switch was formerly called "verbose".

* Regardless of the URL specified, PublishAllItems will execute at the root site within the site collection. The current version does not provide the capability to specify an individual site within a site collection, however it will be included in a future version.

To get help on the command, simply enter STSADM.EXE -help PublishAllItems at a command window.

To run PublishAllItems, you can enter the following command at a command prompt (assuming you have created a new site using the Publishing Portal template provided out-of-the-box in the MOSS 2007 RTW release):
STSADM.EXE -o PublishAllItems -url http://wcm -list Pages

This command will publish all the items within the Pages list in the root web of the Publishing site found in the http://wcm1 site collection. Another example using the two optional parameters is shown below:

Special thanks to Angus Logan who passed along his console app that did a similar thing. I just added some error trapping and made it a custom command for STSADM.EXE, as well as much better memory management.

Command: GenSiteColumnsXml

This command will generate the CAML for a Feature elements manifest file for use in creating site columns in a site, or just those columns within a specific group.

The command has two required parameters and three optional parameters:

Argument Description
-url <url> Required. The URL of any site within a site collection.
-outputFile <full filename> Required. Fully qualified path and filename of the XML file to create containing the site columns.
-groupFilter <group> Optional. If specified, the command will only include site columns belonging to this group within the specified site.
-genNewGuids Optional. If specified, the command replace the actual ID (GUID) of the site column with a new, random GUID.
-stripNameSpaces Optional. If specified, all instances of the hex-encoded HTML space (_x0020_) are removed from the name.

To get help on the command, simply enter STSADM.EXE -help GenSiteColumnsXml at a command window.

To run GenSiteColumnsXml, you can enter the following command at a command prompt (assuming you have created a new site using the Publishing Portal template provided out-of-the-box in the MOSS 2007 RTW release):
STSADM.EXE -o GenSiteColumnsXml -url http://wcm -outputFile "c:\siteColumns.xml"

This command will generate the CAML for a Feature element manifest file for use in creating the site columns defined in the http://wcm site.

Command: GenContentTypesXml

This command will generate the CAML for a Feature's element manifest file for use in creating the content types in a site collection, or just those content types within a specific group.

The command has two required parameters and three optional parameters:

Argument Description
-url <url> Required. The URL of any site within a site collection.
-outputFile <full filename> Required. Fully qualified path and filename of the XML file to create containing the content types.
-groupFilter <group> Optional. If specified, the command will only include content types belonging to this group within the specified site.
-stripNameSpaces Optional. If specified, all instances of the hex-encoded HTML space (_x0020_) are removed from the name of any referenced site columns.
-excludeParentFields Optional. If specified, the site columns defined in the content type's parent content type are not included in the list.

To get help on the command, simply enter STSADM.EXE -help GenContentTypesXml at a command window.

To run GenContentTypesXml, you can enter the following command at a command prompt (assuming you have created a new site using the Publishing Portal template provided out-of-the-box in the MOSS 2007 RTW release):
STSADM.EXE -o GenContentTypesXml -url http://wcm1 -outputFile "c:\contentTypes.xml"

This command will generate XML file for use as an elements manifest file in a WSS v3 Feature containing the content types (and their fields) in the http://wcm site.

posted on Wednesday, October 25, 2006 5:28 PM

Feedback

# re: AC's WCM Custom Commands for STSADM.EXE 1/27/2007 5:16 AM EROL
Gravatar On our BLOG, thanks great article.

http://outilsmoss.blogspot.com/index.html
---
P. Erol GIRAUDY
www.shareclubs.org
www.clubmoss2007.org

 re: AC's WCM Custom Commands for STSADM.EXE 11/3/2006 11:58 AM Chris
Gravatar Do you have some sample code for the pubishall cpmmand?

# re: AC's WCM Custom Commands for STSADM.EXE 11/3/2006 12:20 PM AC [MVP MCMS]
Gravatar Chris - How timely :) check the 2nd to last paragraph of my last post (http://www.andrewconnell.com/blog/archive/2006/11/03/5088.aspx). The code is in shabby shape right now as I'm doing a good bit of refactoring and adding unit testing to the whole solution, as well as adding a few new commands. I hope to release a new version (and the source code) that fixes a big memory management problem with the [PublishAllItems] command and includes the new commands next week during SharePoint Connections. So for now, just stay tuned!

 re: AC's WCM Custom Commands for STSADM.EXE 11/29/2006 4:00 AM LM
Gravatar Hey AC,
Just what i was after - ive downloaded the v0.5.0. However, had to make a small fix up to the source as it seemed to get stuck in a loop when doing subsites;

changing line 67 of PublishedAllItems from

65 // process subsites
66 if (web.Webs.Count > 0) {
67 ProcessWebs(webs);
68 }

to

65 // process subsites
66 if (web.Webs.Count > 0) {
67 ProcessWebs(web.Webs);
68 }

seemed to have the desired affect.

Cheers,
LM

 re: AC's WCM Custom Commands for STSADM.EXE 2/6/2007 2:13 PM Sergio Calleja
Gravatar Hi,
i'm trying to test this command extension (v1.0 & v.0.5) and i can't make that it works.
So, i'm taking a look to code of version 0.5 and i've seen that evaluations:
(listItem.Level == SPFileLevel.Checkout || listItem.Level == SPFileLevel.Draft) //ln 88

and

(listItem.ModerationInformation != null) //100

never takes the value 'true', so never takes any action over items. Which is the problem?

I'm testing it in a MOSS2007 RTM Spanish version.


# re: AC's WCM Custom Commands for STSADM.EXE 2/6/2007 7:53 PM AC [MVP MOSS]
Gravatar Sergio - There are cases when both of those conditions are hit... I'm not sure why it's not working for you. Are you trying this on a Publishing site, or on a regular list with approvial enabled? The command (assume you're talking about PublishAllItems) is only designed to work with Publishing sites.

 re: AC's WCM Custom Commands for STSADM.EXE 2/7/2007 2:58 PM Sergio Calleja
Gravatar I'm trying in a publishing site on the "Pages" Library (in spanish "Páginas" , i've checked that publishing feature is enabled.

Thanks for your answer.

# re: AC's WCM Custom Commands for STSADM.EXE 2/7/2007 11:09 PM AC [MVP MOSS]
Gravatar Sergio - Taking this offline (email)...

 re: AC's WCM Custom Commands for STSADM.EXE 2/13/2007 5:24 AM Andre
Gravatar Hi,

i have installed .NET 3.0 Framework and i will get the following error :

Installing AC's STSADM.EXE Custom Commands for MOSS 2007 Web Content Management
... installing AC's STSADM.EXE Custom Commands for MOSS 2007 Web Content Managem
ent to the GAC

Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Failure adding assembly to the cache: Unknown Error
... add custom command STSADM.EXE configuration file
C:stsadmcommands.ACsWcmCustomCommands.xml

# re: AC's WCM Custom Commands for STSADM.EXE 2/13/2007 8:32 AM AC [MVP MOSS]
Gravatar Andre - It definately works with the .NET FX 3.0, that's a precursor for WSS v3 so it's always the environment when tested. I'd suggest trying to copy the files manually that are outlined in the inistaller batch file included in the download.

# re: AC's WCM Custom Commands for STSADM.EXE 4/18/2007 7:50 PM Reza Alirezaei
Andrew, great post! Thank you very much for sharing.

just a quick note here. In PublishAllItems.cs's Run Method and its finally block ,you need either if (XXX!=null) or another try catch block as following for when the site does not exist at all.Now , when the site does not exist ,finally block tries to dispose it and an object ref exception is thrown and original exception is lost which is "site does not exist...".
finally
{
try
{
rootWeb.Dispose();
siteCollection.RootWeb.Dispose();
siteCollection.Dispose();
}
catch
{

}
}

# re: AC's WCM Custom Commands for STSADM.EXE 4/19/2007 7:43 AM AC [MVP MOSS]
Gravatar Reza-
Thanks for pointing that out!

 re: AC's WCM Custom Commands for STSADM.EXE 6/20/2007 9:45 PM Sriram
Gravatar Great post..

Any tool that does a similar job of exporting Permissions + Groups for a website into an xml or something similar so that the xml can be fed into production environment.

Currently ,I am having to create all permissions and associate new groups in my production environment again and again..

# re: AC's WCM Custom Commands for STSADM.EXE 6/22/2007 4:18 PM AC [MVP MOSS]
Gravatar Sriram-
You can definately do this using custom code... shouldn't be that bad. I'm not aware of any good products that do what you mention.

 re: AC's WCM Custom Commands for STSADM.EXE 7/30/2007 2:36 PM Jay A. Ritchie
Gravatar Andrew-

I just noticed that the code for gensitecolumnsxml uses the Field.TypeAsString property during logging and Field.Type.ToString when outputting the XML. Type.ToString is placing an "Invalid" string in the output file, so I think you should be using TypeAsString in both places.

-Jay

# re: AC's WCM Custom Commands for STSADM.EXE 7/31/2007 1:53 PM AC [MVP MOSS]
Gravatar Jay-
The current build is spitting out the string equiv of the Type property which is a enumeration. A future build will fix this.

 re: AC's WCM Custom Commands for STSADM.EXE 8/1/2007 2:17 PM Jay A. Ritchie
Gravatar Andrew-

I also have found that when you're creating the content type output, you put braces around the ContentType element's ID attribute. Doing so causes the feature to fail when activated.

-Jay

 re: AC's WCM Custom Commands for STSADM.EXE 8/2/2007 4:21 PM Gyan
Gravatar I am getting the following error message in my Application Event Viewer:

Error creating an instance of class "AndrewConnell.SharePoint.StsadmWcmCommands.GenContentTypesXml, AndrewConnell.SharePoint.StsadmWcmCommands, Version=0.5.0.0, Culture=neutral, PublicKeyToken=8edf678998a3e3b5" for the command "gencontenttypesxml" in the extended commands xml file "stsadmcommands.ACsWcmCustomCommands.xml"



# re: AC's WCM Custom Commands for STSADM.EXE 8/13/2007 4:15 PM Gary Lapointe
Gravatar Thought you might find this interesting: http://stsadm.blogspot.com/. I've been working on an upgrade at my company which has necessitated me to create several stsadm extensions. I've still got tons more to create but figured I'd share what I'd done thus far. I'd love to hear your thoughts on whether there's a better way to do any of what I've done. My biggest challenge seems to be SSP configurations.

 re: AC's WCM Custom Commands for STSADM.EXE 8/15/2007 2:57 PM Supermario
Gravatar Here's a copy of my post on the google newsgroups. Any help would be appreciated.

I extended the stsadm.exe utility by following the instruction at:
http://sharepointsolutions.blogspot.com/2006/09/extending-stsadmexe-w...

Now I get an error "Value cannot be null. Parameter name: type" when
trying to run my app. I've even downloaded sample code from MSDN to
try their examples and I get the same error. All other stsadm native
commands work well. When I try to use the -help <MyCustomCommand>
option I get this:


C:\Documents and Settings\Administrator>stsadm -help enumfeatures

Unhandled Exception: System.ArgumentNullException: Value cannot be
null.
Parameter name: type
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at
Microsoft.SharePoint.StsAdmin.SPStsAdmin.GetExtendedCommand(String
type)
at Microsoft.SharePoint.StsAdmin.SPStsAdmin.Main(String[] args)



As far as I can tell the code and the customcommand xml file in the
\12\config hive are correct and it is something else in one of the
base classes. Any suggestions?

# re: AC's WCM Custom Commands for STSADM.EXE 8/15/2007 10:13 PM AC [MVP MOSS]
Gravatar Supermario-
This doesn't really relate to this post. Regardless, not able to understand what the error is.

# re: AC's WCM Custom Commands for STSADM.EXE 8/23/2007 8:35 PM Gary Lapointe
Gravatar Supermario - looks like you're trying to create a command similar to what I've created (enumfeatures) - I've created the very same command and you can find it here: http://stsadm.blogspot.com/. Based on your error it looks as though you either have the wrong class and assembly info in your xml file or you are not returning a string in your GetHelpMessage method (it can't return null).

 re: AC's WCM Custom Commands for STSADM.EXE 9/17/2007 7:52 PM PeterB
FYI: If you get a "Value cannot be null." or a "Unhandled Exception: System.ArgumentNullException" when running the command or help, this is because the DLL's not in the GAC.

I ran the install on a machine without the .NET SDK (and hence GACUTIL.exe) and the command failed. Simply dropping the DLL into C:\Windows\Assembly fixes everything up.

# re: AC's WCM Custom Commands for STSADM.EXE 9/22/2007 5:53 AM Praj Devkota
Gravatar When using the GenContentTypesXml switch, I was getting error message "value does not fall within the expected range" when trying to activate the Site Content Type feature. This problem was fixed after I removed "{" and "}" from the Content Type ID attribute.

Another problem was required fields were not being recognized. This problem was fixed by changing the case of "True" to "TRUE".

I am not sure if this is specific to my environment (MOSS 2007, Win 2003 x64 Edition, SQL 2005 with Collation of Latin1_General_CI_AS_KS_WS). Andrew, it would be good if you could review this and provide an update.


 re: AC's WCM Custom Commands for STSADM.EXE 10/2/2007 4:33 PM mcfin
Gravatar Hey Andrew-

Thanks for sharing your custom commands.

I used GenContentTypesXml command to create the XML for a WSS v3 feature to deploy in a solution. It didn't work until I remembered from your WCM401 class that you said there are no curly braces on the ID. So changed your code in GenerateXmlOutput()
from:
contentTypeAttribute.Value = "{" + contentType.Id+ "}";
to:
contentTypeAttribute.Value = contentType.Id.ToString();


# re: AC's WCM Custom Commands for STSADM.EXE 10/2/2007 4:41 PM AC [MVP MOSS]
Gravatar mcfin-
Yes, that's one of the fixes that you'll see in an updated drop coming soon. :)

 re: AC's WCM Custom Commands for STSADM.EXE 10/25/2007 1:51 AM Felicia
Gravatar Hi Andrew,

I've installed and used the PublishAllItems command from the 0.5.0 version. However, I am having an out of memory issue everytime I include the '-includesubsites' operator.

Any suggestion?


Cheers
Felicia

# re: AC's WCM Custom Commands for STSADM.EXE 10/25/2007 8:56 AM AC [MVP MOSS]
Gravatar Felicia-
That's a known issue. I have another one version that fixes this. Planning an update to my custom commands in the next week or so (before / during SharePoint Connections the week of NOV 5-9th). I'll blog it when its updated.

# re: AC's WCM Custom Commands for STSADM.EXE 10/25/2007 1:23 PM Jason Dossett
Gravatar Hey Andrew, great tool! I was using it to export some site columns and noticed it only exports a subset of the properties for fields. After looking at the code, it appears that the only properties being exported are the base ones on SPField, but there might be more. If it's an SPFieldNumber, for example, it might have min, max, and decimal point properties. I think you might be able to just use SPField.SchemaXml for site columns. The SchemaXml property doesn't appear to work for content types because it looks like it doesn't export content type fields as FieldRef's. Using exported SchemaXml's for fields in combination with your tool's exported content type export worked perfectly.

# re: AC's WCM Custom Commands for STSADM.EXE 10/25/2007 2:05 PM AC [MVP MOSS]
Gravatar Jason-
You'll see a new update of these tools coming shortly (next few weeks) that addresses this.

 re: AC's WCM Custom Commands for STSADM.EXE 11/6/2007 10:10 AM Remo Jongeneelen
Gravatar Hey Andrew,

I've been testing a bit with GenContentTypesXml and while looking at the output it generated, I was wondering if the following fragment is correct:
<XmlDocuments>
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>DocumentLibraryForm</Display>
<Edit>DocumentLibraryForm</Edit>
<New>DocumentLibraryForm</New>
</FormTemplates>
</XmlDocuments>

Shouldn't there be an 'XmlDocument' element as child of 'XmlDocuments' and as parent of 'FormTemplates' element?
At least according to the specs on http://msdn2.microsoft.com/en-us/library/aa543825.aspx...

Further, great initiative!

Cheers

Remo

 re: AC's WCM Custom Commands for STSADM.EXE 11/15/2007 2:00 PM Robert Angers
Gravatar Hi Andrew,
It would be nice to be able to specify the "username" for items to be published.
For example to script publishing all my items when I leave at night.

# re: AC's WCM Custom Commands for STSADM.EXE 11/17/2007 4:09 PM AC [MVP MOSS]
Gravatar Robert-
The source provided... have at it :)

# re: AC's WCM Custom Commands for STSADM.EXE 1/1/2008 10:41 AM Frank Melvin
Gravatar I've been looking for the "silver bullet" that would allow us to checkin multiple documents to a doc lib in WSS 3.0. Didn't see the the "...developing a Publishing Site in MOSS 2007" prerequisite for the PublishAllItems function until I was deploying the solution. The solution deploys and runs fine, however do you have a solution that fits our current need to simply checkin multiple docs in WSS 3.0? We have about 4,900 docs checked out from our initial implementation. We used SharePoint Designer to perform the checkins, but that only worked on some of the files, strangely not all.

Thank you.

-Frank Melvin

# re: AC's WCM Custom Commands for STSADM.EXE 1/1/2008 1:01 PM AC [MVP MOSS]
Gravatar Frank-
No, I don't have anything that does that specifically. But I provide the source for the PublishAllItems on this page. Feel free to download and look at the code that checks stuff in to create your own. SHouldn't take more than 30 minutes to build.

 re: AC's WCM Custom Commands for STSADM.EXE 1/9/2008 4:15 AM Tony Pimm
Gravatar Brilliant article!

Do you have a similar solution to generate the schema XML for lists?

Thanks
Tony

# re: AC's WCM Custom Commands for STSADM.EXE 1/9/2008 7:40 AM AC [MVP MOSS]
Gravatar Tony-
Not yet.

 re: AC's WCM Custom Commands for STSADM.EXE 1/11/2008 12:52 PM Bernadou
Gravatar I've installed this on two different farms, and, both throw: "Object reference not set to an instance of an object." when I attempt to execute the command.

Any ideas?

# re: AC's WCM Custom Commands for STSADM.EXE 1/11/2008 1:14 PM AC [MVP MOSS]
Gravatar Bernadou-
Not without seeing what you entered in. I suspect you didn't enter in a valid URL or missed some other parameters.

 re: AC's WCM Custom Commands for STSADM.EXE 1/11/2008 6:15 PM Bernadou
Gravatar Thanks for the reply...
Here's the output from the command window:
**************************************************
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm.exe -o PublishAllItems -url http://atel-sp2007:8080/tdf

-url <site collection containing items to publish>
-list <name of list containing items to publish>
[-includeSubSites]
[-verbose]

This action will check-in any items checked-out in the specified site collection
, approve, and publish them.

Example:
stsadm.exe -o PublishAllItems
-url http://PublishingSite
-list Pages
-includeSubSites
-verbose

AC's WCM Custom Commands for STSADM.EXE - version 0.5.0.0
> By Andrew Connell
> For more information:
> http://www.andrewconnell.com/blog/articles/MossStsadmWcmCommands.aspx

Object reference not set to an instance of an object.

**************************************************

Also, your documentation states that the process will always execute from the top level site down even if a sub site is specified in the URL. I was testing to see if this was still the case. Can you clarify?

Thanks!
Bernadou


# re: AC's WCM Custom Commands for STSADM.EXE 1/11/2008 9:20 PM AC [MVP MOSS]
Gravatar Bernadou-
You aren't entering a list name, just as it says in the help message. And as the documentation says (and you can see if you check the source), it starts from the root of the site collection and goes down.

 re: AC's WCM Custom Commands for STSADM.EXE 1/15/2008 6:58 AM Egholm
Gravatar Great tool.....saves me a lot of time:o)

 re: AC's WCM Custom Commands for STSADM.EXE 1/23/2008 12:30 PM Barry
I am trying to install but am getting the following error:

Object reference not set to an instance of an object. C:\AndrewConnell.SharePoint.StsadmWcmCommands.wsp: The Solution installation failed.

# re: AC's WCM Custom Commands for STSADM.EXE 1/23/2008 1:08 PM AC [MVP MOSS]
Gravatar Barry-
Check the logs to see what hapened. Did you put the WSP at the root of C?

 re: AC's WCM Custom Commands for STSADM.EXE 1/23/2008 1:50 PM Barry
Yes, I ran the command and checked the logs, and looks like a user-rights error, as I wasn't logged in as farm admin, I will try that and let you know.

 re: AC's WCM Custom Commands for STSADM.EXE 1/30/2008 3:31 AM Justin
Gravatar I ran the command to export the columns, however when i try and use the xml to import them in a feature i get a schema validation failure, as the xml contains a Customization node? The node looks like this:

Customization
ArrayOfProperty
Property
Name ExtensionMask Name
Value .swf Value
Property
ArrayOfProperty
Customization

Any ideas? The field is a custom field type, which also contains a custom property on it. I need to be able to preset the property (as above to .swf) which in initially I thought the output that you had generated would solve for me. But it appears not...

# re: AC's WCM Custom Commands for STSADM.EXE 2/1/2008 10:22 PM AC [MVP MOSS]
Gravatar Justin-
As stated in the article, the commands are not going to generate the 100% perfect XML you need for use in a Feature. You'll need to revisit it a bit to clean some stuff up. The commands take the 80-20 approach where they don't do 100% of the work. I find it easier to edit/tweak XML than to create it from scratch.

 re: AC's WCM Custom Commands for STSADM.EXE 2/2/2008 12:57 PM Miguel
Gravatar Great article and great commands. Very useful. Just a question, will you develop any stsadm commmand to generate the element manifest xml file for the publishing site files? By files, I mean master pages, page layouts, images, css, xsl, js, etc. This command would give WCM developers an even more powerful tool to ease the process of feature construction.

Thanks,
Miguel

# re: AC's WCM Custom Commands for STSADM.EXE 2/8/2008 3:36 PM Àlex Peláez
Gravatar Andrew,
I have the same problem that Sergio reported. My MOSS installation is also in Spanish and the command does not work and does not report any error. I have tried with the lastest version (v0.8.7.1111)

Have you solved it?

Thanks,
Àlex.

# re: AC's WCM Custom Commands for STSADM.EXE 2/9/2008 10:35 AM AC [MVP MOSS]
Gravatar Alex-
The commands were written only for English and weren't localized... sorry about that. I don't have plans to fix that. But the source is provided and you tweak it yourself if you like it.

 re: AC's WCM Custom Commands for STSADM.EXE 2/20/2008 8:45 PM shishir
Gravatar we are using STSADM.exe to backup and restore a site collection but it throws the following error.
"write error on file "wss<Guid>_1.tmp".

do you know where does STSADM create this temp file on? Can we change the path of this temp file?

any help is appreciable!

# re: AC's WCM Custom Commands for STSADM.EXE 2/20/2008 9:11 PM AC [MVP MOSS]
Gravatar shishir-
Sorry... no idea where it is doing this and never seen this error. Maybe use filemon to check the location error.

 re: AC's WCM Custom Commands for STSADM.EXE 3/18/2008 10:16 AM Rolf
Gravatar the command tells me it worked but none of my files are checked in.

STSADM.EXE -o PublishAllItems -url http://kfgin033/RTest -list "Shared Documents"

I installed the lastest version.

Rolf


# re: AC's WCM Custom Commands for STSADM.EXE 3/19/2008 12:27 AM AC [MVP MOSS]
Gravatar Rolf-
Thanks for the post... I'll look into this.

# re: AC's WCM Custom Commands for STSADM.EXE 3/19/2008 2:57 PM Jason Dossett
Gravatar Hey Andrew, I think Justin's issue above wasn't because the generated XML isn't 100%, it's because the wss.xsd file is incomplete! People have noted the issue with creating a feature that deploys a Lookup field that references a list in a different web. wss.xsd doesn't include the attributes needed to allow the XML to be properly validated before it gets deserialized. I've started a codeplex project to gather contributions from the community to 'fix' wss.xsd: http://www.codeplex.com/wssxsd. It's brand spanking new and my first codeplex project, so be patient. :)


# re: AC's WCM Custom Commands for STSADM.EXE 3/19/2008 6:51 PM AC [MVP MOSS]
Gravatar Jason-
While a good idea, I'd be hard pressed to use a community WSS XML schema file. If only one thing was incorrect, it would kill validation in random places.

 re: AC's WCM Custom Commands for STSADM.EXE 3/19/2008 7:10 PM Jason Dossett
Hey Andrew,

I understand your concern. The way I actually have it set up is that people will note known errors to the xsd, and we will create changes, basically diffs, to fix those known errors. The entire project will be focused on the missing attributes and elements that are preventing known, SharePoint-generated XML from being able to be round-tripped. As it stands, there are only two major issues I've seen: Lookup fields and the custom properties for custom field types. I wouldn't be surprised if those were the only two modifications, and those would both be additions, not changes or deletions.

# re: AC's WCM Custom Commands for STSADM.EXE 3/19/2008 7:17 PM AC [MVP MOSS]
Gravatar Jason-
I've got two HUGE wishes: Web Part definition schema & field type schema.

# re: AC's WCM Custom Commands for STSADM.EXE 5/5/2008 3:05 PM Jill
Gravatar great! this was really helpful!

 re: AC's WCM Custom Commands for STSADM.EXE 5/13/2008 12:27 PM tenille bennett
Gravatar Hi there Im trying to create a custom command for stsadm that exports only items which have changed since the last export. Are there any commands which can be used in the class?

# re: AC's WCM Custom Commands for STSADM.EXE 5/13/2008 9:14 PM AC [MVP MOSS]
Gravatar Tenille-
No OOTB command does this... but you can leverage the content migration API for this.

 re: AC's WCM Custom Commands for STSADM.EXE 7/8/2008 2:09 AM Rollercodester
Gravatar Brilliant...just what I was looking for! Great job!

 re: AC's WCM Custom Commands for STSADM.EXE 7/11/2008 7:47 AM JoeB
Gravatar Hi Andrew,

first of all: THANK YOU for your great job in the Sharepoint-Community! I've also attended your session at ODC in San Jose in February with pleasure!

I just ran into an issue I want to share to all sharepoint folks using your great STSADM-extension "GenContentTypesXml":

After generating the mainfest-file for my content-type-feature I tried to install and activate this feature on another machine which worked without any problems. But at the time I first accessed the Site Content Type Gallery my CPU turned into 100% load and nothing happend anymore - no ULS-entries, no error messages, ...
What I tried then was an IISRESET and deactivating the feature again --> same behaviour

First I thought that one of my FieldRefs was causing this very strange behaviour.
But after spending some time in gradually removing one FieldRef after another and trying feature-activation and accessing the Site Content Type Gallery without success I had a content-type without any FieldRef-Element still producing this behaviour...?!?!?!

Just before "giving up" I figured out what the problem was:
In the <XmlDocument>-element the Attribute "NamespaceURI" was missing !!!
I added this attribute and ... it worked!!! YEAH!!!

Bad-XML:
<XmlDocument>
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>

Good-XML:
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>

Maybe you consider this issue in one of your next releases.

Best greetings from Vienna (Austria, Europe)
Joe