Complete reference of all STSADM operations (with parameters) in MOSS 2007 SP1

This is an update to my complete reference of all STSADM operations in Microsoft Office SharePoint Server 2007, now including the changes in Service Pack 1. I repeated what I did for MOSS 2007 in MOSS 2007 SP1, using a little scripting to get the list of all commands for STSADM, including the options and parameters for each. Items new in SP1 are underlined. Please note that some defaults might be related to the way my server is configured.
  1. stsadm -o activatefeature {-filename <relative path to Feature.xml> | -name <feature folder> | -id <feature Id>} [-url <url>] [-force]
  2. stsadm -o activateformtemplate -url <URL to the site collection> [-formid <form template ID>] [-filename <path to form template file>]
  3. stsadm -o addalternatedomain -url <protocol://existing.WebApplication.URLdomain> -incomingurl <protocol://incoming.url.domain> -urlzone <default, extranet, internet, intranet, custom> -resourcename <non-web application resource name>
  4. stsadm -o addcontentdb -url <url> -databasename <database name> [-databaseserver <database server name>] [-databaseuser <database username>] [-databasepassword <database password>] [-sitewarning <site warning count>] [-sitemax <site max count>]
  5. stsadm -o adddataconnectionfile -filename <path to file to add> [-webaccessible <bool>] [-overwrite <bool>] [-category <bool>]
  6. stsadm -o add-ecsfiletrustedlocation -Ssp <SSP name> -Location <URL|UNC> -LocationType SharePoint|Unc|Http -IncludeChildren True|False [-SessionTimeout <time in seconds>] [-ShortSessionTimeout <time in seconds>] [-MaxRequestDuration <time in seconds>] [-MaxWorkbookSize <file size in Mbytes>] [-MaxChartSize <size in Mbytes>] [-VolatileFunctionCacheLifetime <time in seconds>] [-DefaultWorkbookCalcMode File|Manual|Auto|AutoDataTables] [-AllowExternalData None|Dcl|DclAndEmbedded] [-WarnOnDataRefresh True|False] [-StopOpenOnRefreshFailure True|False] [-PeriodicCacheLifetime <time in seconds>] [-ManualCacheLifetime <time in seconds>] [-MaxConcurrentRequestsPerSession <number of requests>] [-AllowUdfs True|False] [-Description <descriptive text>]
  7. stsadm -o add-ecssafedataprovider -Ssp <SSP name> -ID <data provider id> -Type Oledb|Odbc|OdbcDsn [-Description <descriptive text>]
  8. stsadm -o add-ecstrusteddataconnectionlibrary -Ssp <SSP name> -Location <URL> [-Description <descriptive text>]
  9. stsadm -o add-ecsuserdefinedfunction -Ssp <SSP name> -Assembly <strong name|file path> -AssemblyLocation GAC|File [-Enable True|False] [-Description <descriptive text>]
  10. stsadm -o addexemptuseragent -name <user-agent to receive InfoPath files instead of a Web page>
  11. stsadm -o addpath -url <url> -type <explicitinclusion/wildcardinclusion>
  12. stsadm -o addpermissionpolicy -url <url> -userlogin <login name> -permissionlevel <permission policy level> [-zone <URL zone>] [-username <display name>]
  13. stsadm -o addsolution -filename <Solution filename> [-lcid <language>]
  14. stsadm -o addtemplate -filename <template filename> -title <template title> [-description <template description>]
  15. stsadm -o adduser -url <url> -userlogin <DOMAIN\user> -useremail <email address> -role <role name> / -group <group name> -username <display name> [-siteadmin]
  16. stsadm -o addwppack  -filename <Web Part Package filename> [-lcid <language>] [-url <url>] [-globalinstall] [-force] [-nodeploy]
  17. stsadm -o addwppack  -name <name of Web Part Package> [-lcid <language>] [-url <url>] [-globalinstall] [-force]
  18. stsadm -o addzoneurl -url <protocol://existing.WebApplication.URLdomain> -urlzone <default, extranet, internet, intranet, custom> -zonemappedurl <protocol://outgoing.url.domain> -resourcename <non-web application resource name>
  19. stsadm -o allowuserformwebserviceproxy -url <Url of the web application> -enable <true to enable, false to disable>
  20. stsadm -o allowwebserviceproxy -url <Url of the web application> -enable <true to enable, false to disable>
  21. stsadm -o associatewebapp -title <SSP name> [-default | -parent] -url <Web application 1 url,Web application 2 url> [-all]
  22. stsadm -o authentication -url <url> -type <windows/forms/websso> [-usebasic (valid only in windows authentication mode)] [-usewindowsintegrated (valid only in windows authentication mode)] [-exclusivelyusentlm (valid only in windows authentication mode)] [-membershipprovider <membership provider name>] [-rolemanager <role manager name>] [-enableclientintegration] [-allowanonymous]
  23. stsadm -o backup -url <url> -filename <filename> [-overwrite]
  24. stsadm -o backup -directory <UNC path> -backupmethod <full | differential> [-item <created path from tree>] [-percentage <integer between 1 and 100>] [-backupthreads <integer between 1 and 10>] [-showtree] [-quiet]
  25. stsadm -o backuphistory -directory <UNC path> [-backup] [-restore]
  26. stsadm -o binddrservice -servicename <data retrieval service name> -setting <data retrieval services setting>
  27. stsadm -o blockedfilelist -extension <extension> -add [-url <url>]
  28. stsadm -o blockedfilelist -extension <extension> -delete [-url <url>]
  29. stsadm -o canceldeployment -id <id>
  30. stsadm -o changepermissionpolicy -url <url> -userlogin <DOMAIN\name> [-zone <URL zone>] [-username <display name>] [{ -add | -delete } -permissionlevel <permission policy level>]
  31. stsadm -o copyappbincontent
  32. stsadm -o createadminvs [-admapidname <app pool name>] [-admapidtype <configurableid/NetworkService>] [-admapidlogin <DOMAIN\name>] [-admapidpwd <app pool password>]
  33. stsadm -o createcmsmigrationprofile -profilename <profile name> [-description <description>] [-connectionstring <connection string>] -databaseserver <server>  -databasename <name>  -databaseuser <username>  [-databasepassword <password>] [-auth windowsauth|sqlauth] -destination <url> [-rootchannel <channelname>] [-destinationlocale <LCID>] [-migrateresources onlyused|all] [-migrateacls yes|no] [-emailto <address1;address2>] [-emailon success|failure|none|both] [-keeptemporaryfiles Never|Always|Failure] [-enableeventreceivers yes|no]
  34. stsadm -o creategroup -url <url> -name <group name> -description <description> -ownerlogin <DOMAIN\name or group name> [-type member|visitor|owner]
  35. stsadm -o createsite -url <url> -owneremail <email address> [-ownerlogin <DOMAIN\name>] [-ownername <display name>] [-secondaryemail <email address>] [-secondarylogin <DOMAIN\name>] [-secondaryname <display name>] [-lcid <language>] [-sitetemplate <site template>] [-title <site title>] [-description <site description>] [-hostheaderwebapplicationurl <web application url>] [-quota <quota template>]
  36. stsadm -o createsiteinnewdb -url <url> -owneremail <email address> [-ownerlogin <DOMAIN\name>] [-ownername <display name>] [-secondaryemail <email address>] [-secondarylogin <DOMAIN\name>] [-secondaryname <display name>] [-lcid <language>] [-sitetemplate <site template>] [-title <site title>] [-description <site description>] [-hostheaderwebapplicationurl <web application url>] [-quota <quota template>] [-databaseuser <database username>] [-databasepassword <database password>] [-databaseserver <database server name>] [-databasename <database name>]
  37. stsadm -o createssp -title <SSP name> -url <Web application url> -mysiteurl <MySite Web application url> -ssplogin <username> -indexserver <index server> -indexlocation <index file path> [-ssppassword <password>] [-sspdatabaseserver <SSP database server>] [-sspdatabasename <SSP database name>] [-sspsqlauthlogin <SQL username>] [-sspsqlauthpassword <SQL password>] [-searchdatabaseserver <search database server>] [-searchdatabasename <search database name>] [-searchsqlauthlogin <SQL username>] [-searchsqlauthpassword <SQL password>] [-ssl <yes|no>]
  38. stsadm -o createweb -url <url> [-lcid <language>] [-sitetemplate <site template>] [-title <site title>] [-description <site description>] [-convert] [-unique]
  39. stsadm -o databaserepair -url <url> -databasename <database name> [-deletecorruption]
  40. stsadm -o deactivatefeature {-filename <relative path to Feature.xml> | -name <feature folder> | -id <feature Id>} [-url <url>] [-force]
  41. stsadm -o deactivateformtemplate -url <URL to the site collection> [-formid <form template ID>] [-filename <path to form template file>]
  42. stsadm -o deleteadminvs
  43. stsadm -o deletealternatedomain -url <ignored> -incomingurl <protocol://incoming.url.domain>
  44. stsadm -o deletecmsmigrationprofile -profilename <profile name>
  45. stsadm -o deleteconfigdb
  46. stsadm -o deletecontentdb -url <url> -databasename <database name> [-databaseserver <database server name>]
  47. stsadm -o deletegroup -url <url> -name <group name>
  48. stsadm -o deletepath -url <url>
  49. stsadm -o deletepermissionpolicy -url <url> -userlogin <login name> [-zone <URL zone>]
  50. stsadm -o deletesite -url <url> -deleteadaccounts <true/false>
  51. stsadm -o deletesolution -name <Solution name> [-override] [-lcid <language>]
  52. stsadm -o deletessp -title <SSP name> [-deletedatabases]
  53. stsadm -o deletessptimerjob -title <SSP Name> -jobid <SSP Timer Job Id>
  54. stsadm -o deletetemplate -title <template title> [-lcid <language>]
  55. stsadm -o deleteuser -url <url> -userlogin <DOMAIN\name> [-group <group>]
  56. stsadm -o deleteweb -url <url>
  57. stsadm -o deletewppack -name <name of Web Part Package> [-lcid <language>] [-url <url>]
  58. stsadm -o deletezoneurl -url <protocol://existing.WebApplication.URLdomain> -urlzone <default, extranet, internet, intranet, custom> -resourcename <non-web application resource name>
  59. stsadm -o deploysolution -name <Solution name> [-url <virtual server url>] [-allcontenturls] [-time <time to deploy at>] [-immediate] [-local] [-allowgacdeployment] [-allowcaspolicies] [-lcid <language>] [-force]
  60. stsadm -o deploywppack -name <Web Part Package name> [-url <virtual server url>] [-time <time to deploy at>] [-immediate] [-local] [-lcid <language>] [-globalinstall] [-force]
  61. stsadm -o disablessc -url <url>
  62. stsadm -o displaysolution -name <Solution name>
  63. stsadm -o editcmsmigrationprofile -profilename <profile name> [-description <description>] [-connectionstring <connection string>] [-databaseserver <server>] [-databasename <name>] [-databaseuser <username>] [-databasepassword <password>] [-auth sqlauth|windowsauth] [-emailto <address1;address2>] [-emailon success|failure|none|both] [-excludeschema ] [-keeptemporaryfiles Never|Always|Failure] [-enableeventreceivers yes|no]
  64. stsadm -o editcontentdeploymentpath -pathname <path name> [-keeptemporaryfiles Never|Always|Failure] [-enableeventreceivers yes|no] [-enablecompression yes|no]
  65. stsadm -o editssp -title <SSP name> [-newtitle <new SSP name>] [-sspadminsite <administration site url>] [-ssplogin <username>] [-ssppassword <password>] [-indexserver <index server>] [-indexlocation <index file path>] [-setaccounts <process accounts (domain\username)>] [-ssl <yes|no>]
  66. stsadm -o email -outsmtpserver <SMTP server> -fromaddress <email address> -replytoaddress <email address> -codepage <codepage> [-url <url>]
  67. stsadm -o enablecmsurlredirect -profilename <profile name> -off
  68. stsadm -o enablessc -url <url> [-requiresecondarycontact]
  69. stsadm -o enumalternatedomains -url <protocol://existing.WebApplication.URLdomain> -resourcename <non-web application resource name>
  70. stsadm -o enumcontentdbs -url <url>
  71. stsadm -o enumdataconnectionfiledependants -filename <filename for which to enumerate dependants>
  72. stsadm -o enumdataconnectionfiles [-mode <a | u | all | unreferenced>]
  73. stsadm -o enumdeployments
  74. stsadm -o enumexemptuseragents
  75. stsadm -o enumformtemplates
  76. stsadm -o enumgroups -url <url>
  77. stsadm -o enumroles -url <url>
  78. stsadm -o enumservices
  79. stsadm -o enumsites -url <virtual server url> -showlocks -redirectedsites
  80. stsadm -o enumsolutions
  81. stsadm -o enumssp -title <SSP name> [-default | -parent | -all]
  82. stsadm -o enumssptimerjobs -title <SSP Name>
  83. stsadm -o enumsubwebs -url <url>
  84. stsadm -o enumtemplates [-lcid <language>]
  85. stsadm -o enumusers -url <url>
  86. stsadm -o enumwppacks [-name <name of Web Part Package>] [-url <virtual server url>] [-farm]
  87. stsadm -o enumzoneurls -url <protocol://existing.WebApplication.URLdomain> -resourcename <non-web application resource name>
  88. stsadm -o execadmsvcjobs
  89. stsadm -o export -url <URL to be exported> -filename <export file name> [-overwrite] [-includeusersecurity] [-haltonwarning] [-haltonfatalerror] [-nologfile] [-versions <1-4> 1= Last major version for files and list items (default), 2= The current version, either the last major or the last minor, 3= Last major and last minor version for files and list items, 4= All versions for files and list items] [-cabsize <integer from 1-1024 megabytes> (default: 25)] [-nofilecompression] [-quiet]
  90. stsadm -o extendvs -url <url> -ownerlogin <domain\name> -owneremail <email address> [-exclusivelyusentlm] [-ownername <display name>] [-databaseuser <database user>] [-databaseserver <database server>] [-databasename <database name>] [-databasepassword <database user password>] [-lcid <language>] [-sitetemplate <site template>] [-donotcreatesite] [-description <iis web site name>] [-sethostheader] [-apidname <app pool name>] [-apidtype <configurableid/NetworkService>] [-apidlogin <DOMAIN\name>] [-apidpwd <app pool password>] [-allowanonymous]
  91. stsadm -o extendvsinwebfarm -url <url> -vsname <web application name> [-exclusivelyusentlm] [-apidname <app pool name>] [-apidtype <configurableid/NetworkService>] [-apidlogin <DOMAIN\name>] [-apidpwd <app pool password>] [-allowanonymous]
  92. stsadm -o forcedeleteweb -url <url>
  93. stsadm -o formtemplatequiescestatus [-formid <form template ID>] [-filename <path to form template file>]
  94. stsadm -o getadminport
  95. stsadm -o getdataconnectionfileproperty -filename <filename of the data connection file> -pn <property name>
  96. stsadm -o getformsserviceproperty -pn <option name>
  97. stsadm -o getformtemplateproperty [-formid <form template ID>] [-filename <path to form template file>] -pn <property name>
  98. stsadm -o getproperty -propertyname <property name> [-url <url>] (SharePoint cluster properties: avallowdownload, avcleaningenabled, avdownloadscanenabled, avnumberofthreads, avtimeout, avuploadscanenabled, command-line-upgrade-running, database-command-timeout, database-connection-timeout, data-retrieval-services-enabled, data-retrieval-services-oledb-providers, data-retrieval-services-response-size, data-retrieval-services-timeout, data-retrieval-services-update, data-source-controls-enabled, dead-site-auto-delete, dead-site-notify-after, dead-site-num-notifications, defaultcontentdb-password, defaultcontentdb-server, defaultcontentdb-user, delete-web-send-email, irmaddinsenabled, irmrmscertserver, irmrmsenabled, irmrmsusead, job-ceip-datacollection, job-config-refresh, job-database-statistics, job-dead-site-delete, job-usage-analysis, job-watson-trigger, large-file-chunk-size, token-timeout, workflow-cpu-throttle, workflow-eventdelivery-batchsize, workflow-eventdelivery-throttle, workflow-eventdelivery-timeout, workflow-timerjob-cpu-throttle, workitem-eventdelivery-batchsize, workitem-eventdelivery-throttle; SharePoint virtual server properties: alerts-enabled, alerts-limited, alerts-maximum, change-log-expiration-enabled, change-log-retention-period, data-retrieval-services-enabled, data-retrieval-services-inherit, data-retrieval-services-oledb-providers, data-retrieval-services-response-size, data-retrieval-services-timeout, data-retrieval-services-update, data-source-controls-enabled, days-to-show-new-icon, dead-site-auto-delete, dead-site-notify-after, dead-site-num-notifications, defaultquotatemplate, defaulttimezone, delete-web-send-email, job-change-log-expiration, job-dead-site-delete, job-diskquota-warning, job-immediate-alerts, job-recycle-bin-cleanup, job-usage-analysis, job-workflow, job-workflow-autoclean, job-workflow-failover, max-file-post-size, peoplepicker-activedirectorysearchtimeout, peoplepicker-distributionlistsearchdomains, peoplepicker-nowindowsaccountsfornonwindowsauthenticationmode, peoplepicker-onlysearchwithinsitecollection, peoplepicker-searchadcustomquery, peoplepicker-searchadforests, presenceenabled, recycle-bin-cleanup-enabled, recycle-bin-enabled, recycle-bin-retention-period, second-stage-recycle-bin-quota, send-ad-email)
  99. stsadm -o getsitedirectoryscanschedule
  100. stsadm -o getsitelock -url <url>
  101. stsadm -o getsiteuseraccountdirectorypath -url <url>
  102. stsadm -o geturlzone -url <protocol://incoming.url.domain>
  103. stsadm -o grantiis7permission
  104. stsadm -o import -url <URL to import to> -filename <import file name> [-includeusersecurity] [-haltonwarning] [-haltonfatalerror] [-nologfile] [-updateversions <1-3> 1= Add new versions to the current file (default), 2= Overwrite the file and all its versions (delete then insert),3= Ignore the file if it exists on the destination] [-nofilecompression] [-quiet]
  105. stsadm -o installfeature {-filename <relative path to Feature.xml from system feature directory> | -name <feature folder>} [-force]
  106. stsadm -o listlogginglevels [-showhidden]
  107. stsadm -o listregisteredsecuritytrimmers -ssp <ssp name>
  108. stsadm -o localupgradestatus
  109. stsadm -o managepermissionpolicylevel -url <url> -name <permission policy level name> [{ -add | -delete }] [-description <description>] [-siteadmin <true | false>] [-siteauditor <true | false>] [-grantpermissions <comma-separated list of permissions>] [-denypermissions <comma-separated list of permissions>]
  110. stsadm -o mergecontentdbs -url <url> -sourcedatabasename <source database name> -destinationdatabasename <destination datbabase name> [-operation <1-3> 1 – Analyze (default) 2 – Full Database Merge 3 – Read from file] [-filename <file generated from stsadm -o enumsites>]
  111. stsadm -o migrateuser -oldlogin <DOMAIN\name> -newlogin <DOMAIN\name> [-ignoresidhistory]
  112. stsadm -o osearch [-action <list|start|stop>] required parameters for ‘start’ (if not already set): role, farmcontactemail, service credentials [-f (suppress prompts)] [-role <Index|Query|IndexQuery>] [-farmcontactemail <email>] [-farmperformancelevel <Reduced|PartlyReduced|Maximum>] [-farmserviceaccount <DOMAIN\name> (service credentials)] [-farmservicepassword <password>] [-defaultindexlocation <directory>] [-propagationlocation <directory>] [-cleansearchdatabase <true|false>] [-ssp <ssp name>] required parameter for ‘cleansearchdatabase’
  113. stsadm -o osearchdiacriticsensitive -ssp <ssp name> [-setstatus <True|False>] [-noreset] [-force]
  114. stsadm -o preparetomove {-ContentDB <DatabaseServer:DatabaseName> | -Site <URL>} [-OldContentDB <uniqueidentifier>] [-undo]
  115. stsadm -o profilechangelog -title <SSP Name> -daysofhistory <number of days> -generateanniversaries
  116. stsadm -o profiledeletehandler -type <Full Assembly Path>
  117. stsadm -o provisionservice -action <start/stop> -servicetype <servicetype (namespace or assembly qualified name if not SharePoint service)> [-servicename <servicename>]
  118. stsadm -o quiescefarm -maxduration <duration in minutes>
  119. stsadm -o quiescefarmstatus
  120. stsadm -o quiesceformtemplate [-formid <form template ID>] [-filename <path to form template file>] -maxduration <time in minutes>
  121. stsadm -o reconvertallformtemplates
  122. stsadm -o refreshdms -url <url>
  123. stsadm -o refreshsitedms -url <url>
  124. stsadm -o registersecuritytrimmer -ssp <ssp name> -id <0 – 2147483647> -typename <assembly qualified TypeName of ISecurityTrimmer implementation> -rulepath <crawl rule URL> [-configprops <name value pairs delimited by ‘~’>]
  125. stsadm -o registerwsswriter
  126. stsadm -o removedataconnectionfile -filename <filename to remove>
  127. stsadm -o removedrservice -servicename <data retrieval service name> -setting <data retrieval services setting>
  128. stsadm -o remove-ecsfiletrustedlocation -Ssp <SSP name> -Location <URL|UNC> -LocationType SharePoint|Unc|Http
  129. stsadm -o remove-ecssafedataprovider -Ssp <SSP name> -ID <data provider id> -Type Oledb|Odbc|OdbcDsn
  130. stsadm -o remove-ecstrusteddataconnectionlibrary -Ssp <SSP name> -Location <URL>
  131. stsadm -o remove-ecsuserdefinedfunction -Ssp <SSP name> -Assembly <strong name|file path> -AssemblyLocation GAC|File
  132. stsadm -o removeexemptuseragent -name <user-agent to receive InfoPath files instead of a Web page>
  133. stsadm -o removeformtemplate [-formid <form template ID>] [-filename <path to form template file>]
  134. stsadm -o removesolutiondeploymentlock [-server <server> [-allservers]
  135. stsadm -o renameserver -oldservername <oldServerName> -newservername <newServerName>
  136. stsadm -o renamesite -oldurl <oldUrl> -newurl <newUrl> 
  137. stsadm -o renameweb -url <url> -newname <new subsite name>
  138. stsadm -o restore -url <url> -filename <filename> [-hostheaderwebapplicationurl <web application url>] [-overwrite]
  139. stsadm -o restore -directory <UNC path> -restoremethod <overwrite | new> [-backupid <Id from backuphistory, see stsadm -help backuphistory>] [-item <created path from tree>] [-percentage <integer between 1 and 100>] [-showtree] [-suppressprompt] [-username <username>] [-password <password>] [-newdatabaseserver <new database server name>] [-quiet]
  140. stsadm -o restoressp -title <SSP name> -url <Web application url> -ssplogin <username> -mysiteurl <MySite Web application url> -indexserver <index server> -indexlocation <index file path> [-keepindex] -sspdatabaseserver <SSP database server> -sspdatabasename <SSP database name> [-ssppassword <password>] [-sspsqlauthlogin <SQL username>] [-sspsqlauthpassword <SQL password>] [-searchdatabaseserver <search database server>] [-searchdatabasename <search database name>] [-searchsqlauthlogin <SQL username>] [-searchsqlauthpassword <SQL password>] [-ssl <yes|no>]
  141. stsadm -o retractsolution -name <Solution name> [-url <virtual server url>] [-allcontenturls] [-time <time to remove at>] [-immediate] [-local] [-lcid <language>]
  142. stsadm -o retractwppack -name <Web Part Package name> [-url <virtual server url>] [-time <time to retract at>] [-immediate] [-local] [-lcid <language>]
  143. stsadm -o runcmsmigrationprofile -profilename <profile name> [-skipanalyzer ] [-onlyanalyzer ] [-startover ] [-migratesincetime <DateTime string>] [-migrationfolder <path>] [-exportonly ] [-importonly ] [-htmldiff <path>]
  144. stsadm -o runcontentdeploymentjob -jobname <name> [-wait yes|no] [-deploysincetime <datetime>] (<datetime> as “MM/DD/YY HH:MM:SS”)
  145. stsadm -o scanforfeatures [-solutionid <Id of Solution>] [-displayonly]
  146. stsadm -o setadminport -port <port> [-ssl] [-admapcreatenew] [-admapidname <app pool name>]
  147. stsadm -o setapppassword -password <password>
  148. stsadm -o setbulkworkflowtaskprocessingschedule -schedule <recurrence string>
  149. stsadm -o setconfigdb [-connect] -databaseserver <database server> [-databaseuser <database user>] [-databasepassword <database user password>] [-databasename <database name>] [-exclusivelyusentlm] [-farmuser] [-farmpassword] [-adcreation] [-addomain <Active Directory domain>] [-adou <Active Directory OU>]
  150. stsadm -o setcontentdeploymentjobschedule -jobname <name> -schedule <schedule> (Schedule Parameter Examples: “every 5 minutes between 0 and 59”, “hourly between 0 and 59”, “daily at 15:00:00”, “weekly between Fri 22:00:00 and Sun 06:00:00”, “monthly at 15 15:00:00”, “yearly at Jan 1 15:00:00”)
  151. stsadm -o setdataconnectionfileproperty -filename <filename of the data connection file> -pn <property name> -pv <property value>
  152. stsadm -o setdefaultssp -title <SSP name>
  153. stsadm -o set-ecsexternaldata -Ssp <SSP name> [-ConnectionLifetime <time in seconds>] [-UnattendedServiceAccountName <account name>] [-UnattendedServiceAccountPassword <account password>]
  154. stsadm -o set-ecsloadbalancing -Ssp <SSP name> [-Scheme WorkbookUrl|RoundRobin|Local] [-RetryInterval <time in seconds>]
  155. stsadm -o set-ecsmemoryutilization -Ssp <SSP name> [-MaxPrivateBytes <memory in MBytes>] [-MemoryCacheThreshold <percentage>] [-MaxUnusedObjectAge <time in minutes>]
  156. stsadm -o set-ecssecurity -Ssp <SSP name> [-FileAccessMethod UseImpersonation|UseFileAccessAccount] [-AccessModel Delegation|TrustedSubsystem] [-RequireEncryptedUserConnection False|True] [-AllowCrossDomainAccess True|False]
  157. stsadm -o set-ecssessionmanagement -Ssp <SSP name> [-MaxSessionsPerUser <number of sessions>]
  158. stsadm -o set-ecsworkbookcache -Ssp <SSP name> [-Location <local or UNC path>] [-MaxCacheSize <storage in Mbytes>] [-EnableCachingOfUnusedFiles True|False]
  159. stsadm -o setformsserviceproperty -pn <option name> -pv <option value>
  160. stsadm -o setformtemplateproperty [-formid <form template ID>] [-filename <path to form template file>] -pn <property name> -pv <property value>
  161. stsadm -o setholdschedule -schedule <recurrence string>
  162. stsadm -o setlogginglevel [-category < [CategoryName | Manager:CategoryName [;…]] >] {-default | -tracelevel  < None;  Unexpected; Monitorable; High; Medium; Verbose> [-windowslogginglevel < None;  ErrorServiceUnavailable;  ErrorSecurityBreach;  ErrorCritical;  Error;  Warning;  FailureAudit; SuccessAudit;  Information;  Success>] }
  163. stsadm -o setpolicyschedule -schedule <recurrence string>
  164. stsadm -o setproperty -propertyname <property name> -propertyvalue <property value> [-url <url>] (SharePoint cluster properties:, avallowdownload, avcleaningenabled, avdownloadscanenabled, avnumberofthreads, avtimeout, avuploadscanenabled, command-line-upgrade-running, database-command-timeout, database-connection-timeout, data-retrieval-services-enabled, data-retrieval-services-oledb-providers, data-retrieval-services-response-size, data-retrieval-services-timeout, data-retrieval-services-update, data-source-controls-enabled, dead-site-auto-delete, dead-site-notify-after, dead-site-num-notifications, defaultcontentdb-password, defaultcontentdb-server, defaultcontentdb-user, delete-web-send-email, irmaddinsenabled, irmrmscertserver, irmrmsenabled, irmrmsusead, job-ceip-datacollection, job-config-refresh, job-database-statistics, job-dead-site-delete, job-usage-analysis, job-watson-trigger, large-file-chunk-size, token-timeout, workflow-cpu-throttle, workflow-eventdelivery-batchsize, workflow-eventdelivery-throttle, workflow-eventdelivery-timeout, workflow-timerjob-cpu-throttle, workitem-eventdelivery-batchsize, workitem-eventdelivery-throttle; SharePoint virtual server properties:, alerts-enabled, alerts-limited, alerts-maximum, change-log-expiration-enabled, change-log-retention-period, data-retrieval-services-enabled, data-retrieval-services-inherit, data-retrieval-services-oledb-providers, data-retrieval-services-response-size, data-retrieval-services-timeout, data-retrieval-services-update, data-source-controls-enabled, days-to-show-new-icon, dead-site-auto-delete, dead-site-notify-after, dead-site-num-notifications, defaultquotatemplate, defaulttimezone, delete-web-send-email, job-change-log-expiration, job-dead-site-delete, job-diskquota-warning, job-immediate-alerts, job-recycle-bin-cleanup, job-usage-analysis, job-workflow, job-workflow-autoclean, job-workflow-failover, max-file-post-size, peoplepicker-activedirectorysearchtimeout, peoplepicker-distributionlistsearchdomains, peoplepicker-nowindowsaccountsfornonwindowsauthenticationmode, peoplepicker-onlysearchwithinsitecollection, peoplepicker-searchadcustomquery, peoplepicker-searchadforests, presenceenabled, recycle-bin-cleanup-enabled, recycle-bin-enabled, recycle-bin-retention-period, second-stage-recycle-bin-quota, send-ad-email)
  165. stsadm -o setrecordsrepositoryschedule -schedule <recurrence string>
  166. stsadm -o setsearchandprocessschedule -schedule <recurrence string>
  167. stsadm -o setsharedwebserviceauthn -ntlm | -negotiate
  168. stsadm -o setsitedirectoryscanschedule -schedule <recurrence string> (Schedule parameter examples: “every 5 minutes between 0 and 59”, “hourly between 0 and 59”, “daily at 15:00:00”, “weekly between Fri 22:00:00 and Sun 06:00:00”, “monthly at 15 15:00:00”, “yearly at Jan 1 15:00:00”)
  169. stsadm -o setsitelock -url <url> -lock <none | noadditions | readonly | noaccess>
  170. stsadm -o setsiteuseraccountdirectorypath -url <url> [-path <path>]
  171. stsadm -o setsspport -httpport <HTTP port number> -httpsport <HTTPS port number>
  172. stsadm -o setworkflowconfig -url <url> {-emailtonopermissionparticipants <enable|disable> | -externalparticipants <enable|disable> | -userdefinedworkflows <enable|disable>}
  173. stsadm -o siteowner -url <url> [-ownerlogin <DOMAIN\name>] [-secondarylogin <DOMAIN\name>]
  174. stsadm -o spsearch [-action <list | start | stop | attachcontentdatabase | detachcontentdatabase | fullcrawlstart | fullcrawlstop>] [-f (suppress prompts)] [-farmperformancelevel <Reduced | PartlyReduced | Maximum>] [-farmserviceaccount <DOMAIN\name> (service credentials)] [-farmservicepassword <password>] [-farmcontentaccessaccount <DOMAIN\name>] [-farmcontentaccesspassword <password>] [-indexlocation <new index location>] [-databaseserver <server\instance> (default: josebda-moss)] [-databasename <database name> (default: SharePoint_WSS_Search)] [-sqlauthlogin <SQL authenticated database user>] [-sqlauthpassword <password>] -action list -action stop [-f (suppress prompts)] -action start -farmserviceaccount <DOMAIN\name> (service credentials) [-farmservicepassword <password>] -action attachcontentdatabase [-databaseserver <server\instance> (default: josebda-moss)] -databasename <content database name> [-searchserver <search server name> (default: josebda-moss)] -action detachcontentdatabase [-databaseserver <server\instance> (default: josebda-moss)] -databasename <content database name> [-f (suppress prompts)] -action fullcrawlstart -action fullcrawlstop
  175. stsadm -o spsearchdiacriticsensitive [-setstatus <True|False>] [-noreset] [-force]
  176. stsadm -o sync {-ExcludeWebApps <web applications> | -SyncTiming <schedule(M/H/D:value)> | -SweepTiming <schedule(M/H/D:value)> | -ListOldDatabases <days> | -DeleteOldDatabases <days>}
  177. stsadm -o syncsolution -name <Solution name>] [-lcid <language>] [-alllcids]
  178. stsadm -o syncsolution -allsolutions
  179. stsadm -o unextendvs -url <url> [-deletecontent] [-deleteiissites]
  180. stsadm -o uninstallfeature {-filename <relative path to Feature.xml> | -name <feature folder> | -id <feature Id>} [-force]
  181. stsadm -o unquiescefarm
  182. stsadm -o unquiesceformtemplate [-formid <form template ID>] [-filename <path to form template file>]
  183. stsadm -o unregistersecuritytrimmer -ssp <ssp name> -id <0 – 2147483647>
  184. stsadm -o unregisterwsswriter
  185. stsadm -o updateaccountpassword -userlogin <DOMAIN\name> -password <password> [-noadmin]
  186. stsadm -o updatealerttemplates -url <url> [-filename <filename>] [-lcid <language>
  187. stsadm -o updatefarmcredentials [-identitytype <configurableid/NetworkService>] [-userlogin <DOMAIN\name>] [-password <password>] [-local [-keyonly]]
  188. stsadm -o upgrade {-inplace | -sidebyside} [-url <url>] [-forceupgrade] [-quiet] [-farmuser <farm user>] [-farmpassword <farm user password>] [-reghost] [-sitelistpath <sites xml file>]
  189. stsadm -o upgradeformtemplate -filename <path to form template file> [-upgradetype <upgrade type>]
  190. stsadm -o upgradesolution -name <Solution name> -filename <upgrade filename> [-time <time to upgrade at>] [-immediate] [-local] [-allowgacdeployment] [-allowcaspolicies] [-lcid <language>]
  191. stsadm -o upgradetargetwebapplication -url <URL to upgrade> -relocationurl <new URL for non-upgraded content> -apidname <new app pool name> [-apidtype <configurableid/NetworkService>] [-apidlogin <DOMAIN\name>] [-apidpwd <app pool password>] [-exclusivelyusentlm]
  192. stsadm -o uploadformtemplate -filename <path to form template file>
  193. stsadm -o userrole -url <url> -userlogin <DOMAIN\name> -role <role name> [-add] [-delete]
  194. stsadm -o verifyformtemplate -filename <path to form template file>
Advertisements

Deploying a SharePoint Extranet Solution

In a recent project I had some unique requirements for an extranet solution I was building.  I am usually involved in intranet facing projects, so this taught me a few things.  Doesn’t every project?

Here were some of the requirements:

1. SSL (of course) is required

2. Extranet access for a couple hundred people scattered around the country.  We decided on Basic authentication due to the mixture of client types and the need to integrate with Office (which ruled out FBA).

3. Need to ensure enterprise search is functioning

4. Ensure https redirection is automatic.  For example, if user accesses http://portal.synergy.com, it must automatically redirect to https://portal.synergy.com.  This portal.synergy.com domain was not the real domain, but the one I will use as the example for this article.

These are pretty straightforward requirements, but there were a number of issues that surfaced did not have obvious solutions.  In this article, I discuss the issues I had, and how I worked around them. 

When creating the primary web application, I configured it to use SSL upon creation.  It looked similar to this screen shot (click to enlarge):

image
Figure 1: Creating Initial Web Application

 You’ll notice that you cannot select Basic when you create it, so I chose NTLM (Windows NT Lan Manager) for now. 

From here, I created and bound the SSL certificate to the Web Site in IIS and set the Require SSL checkbox in IIS.  I then created a root site collection.  At this point, the web site came up just fine, and requirement #1 was in place.

Next step is to get basic authentication in place.  This is pretty easy and can be done from the authentication providers link within Application Management.  I changed the default zone (at this point, the only zone) to now use Basic authentication.  The modified configuration now looks like this:

image
Figure 2: Configuring Basic authentication

 Requirements #1 and #2 are now done.  Unfortunately, setting this to basic auth introduced a small problem.  Unfortunately, when crawling content, the SharePoint search engine is unable to authenticate using basic authentication.  This means that I would not be able to implement search.  Big problem, acutally.  Thanks to my colleague Milan Gross who pointed this out, this was a pretty easy workaround.  What I did is created another zone that would be used only for searching.  This would not be exposed to users since it’s just an internal mapping, and it would be configured to use NTLM.

To do this, I first extended the https://synergy.portal.com web application to a new zone, and I configured this the intranet zone.  Here is how it looked prior to saving:

image
Figure 3: Extending to intranet zone for crawling

 When configuring the content sources, I made sure that intranet Url http://spserver:80 was the Url crawled, not the default one (https://portal.synergy.com).  A simplified view of the content sources looks like this:

image
Figure 4: Content sources

 Issuing a full crawl and then a few test searches, I was happy that requirement #3 was now functional.

The final step was to make sure http to http redirection (requirement #4) was working.  Since we were using Windows Server 2008 for the WFEs, we used the nifty HTTP Redirect part of IIS 7.  However, this combination of requirements made it a tad more complex.  You see, I didn’t have an IIS Web Site that accepts port 80 requests on the http://portal.synergy.com url.  That is, my IIS web site bindings only shows port 443 as you can see here:

image
Figure 5: Bindings for primary web application (IIS Web Site)

 I tried a number of combinations to get it to work the way I wanted, but in the end, the option that I went with was extending the web application yet another time, this time to http://portal.synergy.com.  I opted to place this into the Custom zone.  Here’s how the extended web was created:

image
Figure 6: Extending to custom zone for http to https redirection

 I then went to the authentication settings, figuring I probably want this to also use basic auth.  So, for this new custom zone, I made the settings match that of Figure 2 above.  I then went into IIS and enabled IIS redirection.  Here’s how the redirection screen was configured:

image
Figure 7: Configuring IIS redirect

 Note: For those looking for IIS Redirect in IIS 7, you must specifically install it as a Role Service from Server Manager.  It is not installed automatically.

At this point, I thought I was done, but I realized a peculiar problem.  When signing in, it was redirecting properly, but was also requiring me to log in two different times.  Here is the login screen that I would always get twice:

image
Figure 8: Basic auth sign in screen

 So I was close.  What I’m guessing was happening is that is first authenticating to the http site instance (the custom zone).  It then is redirecting per IIS to the https site instance (the default zone).  Upon this redirection, the credentials aren’t preserved; hence, I need to log in again.  After thinking about this a bit, I thought, “Hey, what if I just set the custom zone to allow anonymous?”  I really don’t want to allow anonymous users, but all I care about is getting the initial redirect to work to the default (https) zone.  Here is where I would then do the authentication.  I was a bit skeptical at first thinking I am opening up a security hole, but it seems to work just fine.  I’ve done a number of tests and can’t see a problem.

I also realized that if I have basic auth enabled on an http connection, the username and password credentials are being delivered across the wire unencrypted.  Very bad.

Ok, so here is how the custom zone is now configured.  Notice that I only use anonymous access and clear Integrated Windows and Basic authentication.

image
Figure 9: Configuring custom zone to use anonymous

 From this point, all four requirements are met, and the solution works like a charm.  Hopefully this post gives you some ideas and pointers on how you can do something similar.  Good luck to you all.

 

Reference : http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=52

Downloading all List Items from SharePoint List programatically

Hello All,

Recently i came across a little requirement to download all the
development site files and need to update the Solution package.
I went down some time goggling:) but didn't got what i need and
that time makes me to sit
and write the below code which is working with in a
console application,

using System;
using Microsoft.SharePoint;
using System.IO;
using System.Collections;

namespace DownloadfilesSharepoint
{
    class AppClass
    {

        static string m_strExportDir = @"C:\ListFilesDownloads";
        static bool m_RecurseFolders = false;

        [STAThread]
        static void Main(string[] args)
        {
            SPSite siteColl = new SPSite("http://dev06:80/");
            SPWeb webcol = siteColl.OpenWeb();

            m_RecurseFolders = true;
            //SPList oList = 
            webcol.GetCatalog(SPListTemplateType.MasterPageCatalog);
            // SPList oList = webcol.Lists["Web Part Gallery"];
            SPList oList = webcol.Lists["Style Library"];
            SPDocumentLibrary docLibrary = (SPDocumentLibrary)oList;
            GetFolderDetails(docLibrary.RootFolder);
        }

        static long GetFolderDetails(SPFolder folder)
        {
            SPSite siteColl = new SPSite("http://dev06:80/");
            SPWeb webcol = siteColl.OpenWeb();

            string strPath = null;
            long lFolderSize = 0;
            strPath = CheckPathAndCreate(folder.ServerRelativeUrl);
            #region
            //Below Loop is for to Download all the webparts in the Top-Level Site
            // foreach (SPFile file in webcol.GetFolder("/_catalogs/wp").Files)

            #endregion

            #region
         //Download all the Masterpage files in the Top-Level Site
         // foreach (SPFile file in webcol.GetFolder("/_catalogs/masterpage").Files)

            #endregion
            //Download all the Files of Style Library in the Top-Level Site
            foreach (SPFile file in folder.Files)
            {

                string sFileLoc = m_strExportDir + strPath + "\\" + file.Name;             
                byte[] binFile = file.OpenBinary();
                FileStream fs =
                new FileStream(sFileLoc, FileMode.OpenOrCreate, FileAccess.Write);
                fs.Write(binFile, 0, binFile.Length);
                fs.Close();
                    // You could use this code to run through all the files in every folder
                    // on the web, to calculate the total size of the files in the web.
                    // something like the following:
                    lFolderSize += file.Length;
                }

            if (m_RecurseFolders)
            {
                foreach (SPFolder subfolder in folder.SubFolders)
                    GetFolderDetails(subfolder);
            }
            return lFolderSize;
        }

        static string CheckPathAndCreate(string ServerRelativeUrl)
        {
            string strPath;
            strPath = ServerRelativeUrl.Replace("/", "\\");

            System.IO.Directory.CreateDirectory(m_strExportDir + strPath);
            return strPath;
        }
    }
}
Hope it will help some one !!!

Rgrds//Praveen

How to Add DLLs to a WSP SharePoint Solution

This is probably well documented somewhere, but I couldn’t find it within 10 minutes, so I decided to blog it.

If you have a sharepoint wsp, and you want it to deploy additional dlls to a site collection’s bin directory when it is deployed, then you can add a line to your cab.ddf and your manifest.xml files to make this happen. In the cab.ddf, you can add a line like

pathToDll\TheDll.dll TheDll.dll

This will put the dll in your wsp cab file. Then in your manifest.xml file, add a new assembly entry in assemblies like

<Assembly DeploymentTarget=”WebApplication” Location=”TheDll.dll” />

Just to clarify, I’ll put examples of each file.

 

—cab.ddf—

; This is the file that you pass to makecab utility, as in “makecab /f cab.ddf”

.OPTION EXPLICIT ; Generate errors

.Set CabinetNameTemplate=SPInstaller.wsp

.Set DiskDirectoryTemplate=CDRom ; all cabinets go in a single directory

.Set CompressionType=MSZIP ; all files compressed in cabinet files

.Set UniqueFiles=”ON”

.Set Cabinet=on

.Set DiskDirectory1=Package

 

Solution\manifest.xml manifest.xml

TEMPLATE\FEATURES\MyFeature\feature.xml MyFeature\feature.xml

TEMPLATE\FEATURES\MyFeature\elements.xml MyFeature\elements.xml

 

TEMPLATE\FEATURES\MyFeature\dwp\MyWebPart.webpart FEATURES\ArrowWebParts\dwp\MyWebPart.webpart

 

; this is the important part for this article

; both of the dlls are stuffed into the wsp

bin\Release\MyFeature.dll MyFeature.dll

bin\Release\TheDll.dll TheDll.dll

 

 

—-manifest.xml—

<?xml version=”1.0″ encoding=”utf-8″ ?>

<Solution SolutionId=”00000000-0000-0000-0000-000000000000″

xmlns=”http://schemas.microsoft.com/sharepoint/&#8221; >

<FeatureManifests>

<FeatureManifest Location=”MyFeature\feature.xml”/>

</FeatureManifests>

<TemplateFiles>

<TemplateFile Location=”FEATURES\MyFeature\dwp\MyWebPart.webpart”/>

</TemplateFiles>

<Assemblies>

<!– choose DeploymentTarget=”WebApplication” –>

<Assembly DeploymentTarget=”WebApplication” Location=”MyFeature.dll”>

<SafeControls>

<SafeControl Assembly=”MyFeature” Namespace=”MyWebParts” TypeName=”*” Safe=”True”/>

</SafeControls>

</Assembly>

<!– The other dll is added with another assembly entry –>

<Assembly DeploymentTarget=”WebApplication” Location=”TheDll.dll” />

</Assemblies>

<CodeAccessSecurity>

<PolicyItem>

<PermissionSet version=”1″ Description=”Permissions for WRWebParts”>

<IPermission version=”1″ Level=”Minimal” />

<IPermission version=”1″ Flags=”Execution” />

<IPermission version=”1″ Connections=”True” />

<IPermission version=”1″ Unrestricted=”true” />

</PermissionSet>

<Assemblies>

<Assembly Name=”ArrowWebParts”/>

</Assemblies>

</PolicyItem>

</CodeAccessSecurity>

</Solution>

This solution contains resources scoped for a Web application and must be deployed to one or more Web applications

There are quite a few intricacies which can result in following error message during sharepoint workflow deployment.
This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.
One of such scenarios described here with possible solution.
I was trying to deploy a workflow having InfoPath form on it. But in development machine I don’t have MOSS installed. I copied allsharepoint( and sharepoint-workflow) dlls locally. This build fine. No compilation error.
But when I was creating WSP package using WSPBuilder it was giving a warning message:
“Could not resolve: Microsoft.SharePoint.WorkflowActions, Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c. Please define the -DLLReferencePath with the path to the referenced assemblies. However a SafeControl tag for the WorkflowCode.MyWorkflow class has been created.”

If you deploy this solution using command line tool in MOSS it gives “This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.” error message.

You can still configure this solution from administration UI.

There are two ways to fis this:
1) simply GAC the dll in you development machine. This willl ensure you don’t get the warning message in package creation and no error on deployment either.
2) depending on the reference dll’s and their trust level WSP builder creates as safe control list. Now when the above dll is not gac’ed WSPbuilder creates

To deploy this package correctly either delete safe control list manually from the manifest file. Manifest file is located insidegenerated WSP file.

Alternatively set the “-BuildSafeControls false” in the wspbuilderconfiguration.

This may not be the best option, but it’s solves the issue.

STSDEV – tips and tricks for WSP deployment

For those of you who have given up using any versions of Visual Studio extension for Windows SharePoint Services 3.0
(a.k.a. VSeWSS 1.01.11.2)

                                 GOOD ON YA!!!

– You’ve just saved yourself loads of pain.

(I think this itself deserves a good post, my colleagues are currently building the next version of VSeWSS at the time of this post, may God be with them!)

For those of you who have taken up WSPBuilder or STSDEV,

                              GOOD ON YA!!! (X2)

– SharePoint development have just become less painful :)

Here are a few tips and tricks I learnt along the way and from my experienced and knowledgeable colleagues from Intergen.

#1. Why STSDEV is ignoring changes made in targets file?

Close your solution in Visual Studio and reopen it, and yes we’ll have to repeat this each time we make a change to the targets file. I know it’s a pain in the bum.

What is up with this close/reopen business and how to fix it? When you find out, please dolet me know :)

#2. Why is my solution deployed globally?

image

After a project is created with STSDEV, the default solution deployment command under DebugDeploy Target in targets file is;

<Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate" />

To change your deployment to a site collection;

<Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate -allowgacdeployment -url $(TargetUrl)  -force" />

where $(TargetUrl) is defined as a property between <PropertyGroup> tags at the beginning of the targets file;

<PropertyGroup>
  <PackageName>Play.wsp</PackageName>
  <PackageFile>Play.wsp</PackageFile>
  <TargetUrl>http://intranet/</TargetUrl>
  <!-- Other properties omitted -->
</PropertyGroup>

#3. “This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.”

This is a tricky one. The error message is very generic and can mean many things… To resolve it, you need to flick between the targets file and the SolutionConfig.xml file, make changes and trying deploying it.

image

Remember, each time you make a change to the targets file, close your solution and reopen it for it to take effect in the build.

If you’ve written any custom code in the project, like event receivers, and you need deploy this assembly to GAC. You’ll have to make each and very single following points are addressed.

(Depend on the option combinations you chose when you created the solution with STSDEV, none / some / all of these should have been done for you.)

a. The assembly is signed with a key file. (Project -> properties)

image

b. In SolutionConfig.xml, allow GAC deployment and safe control.

<AssemblyDeployment>True</AssemblyDeployment>
<SafeControlSettings>True</SafeControlSettings>

c. In SolutionConfig.xml, specify the safe control.

<Assemblies>
    <Assembly Location="Play.dll" DeploymentTarget="GlobalAssemblyCache">
        <SafeControls>
            <SafeControl Assembly="Play, Version=0.0.0.0, Culture=neutral, PublicKeyToken=abbe9e18e07720bf" Namespace="Play" TypeName="*" Safe="True" />
        </SafeControls>
    </Assembly>
</Assemblies>

You can get the assembly name by opening up the dll in reflector after signing it with a key and compiled the project.

image

d. In targets file, under BuildDeploy target, solution deploy command allows GAC deployment.

<Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate -allowgacdeployment -url $(TargetUrl) -force" />

e. If solution is to deploy to a site collection, specify the URL in the deploy command as well, so it knows which web config to place the safe control in. (See the above code snippet.)

f. If you are intending to deploy to all Site Collections in this Web Application, make sure you specify so by having a -allcontenturl switch in the command.

<Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate -allowgacdeployment -allcontenturls -force" />

Failing all above, keep Live.com ‘in ;)

#4. “This solution contains resources scoped for a Web application and must be retracted from one or more Web applications.”

If you have successfully deployed your wsp solution to a specific site collection following the steps in #2 and 3, then you might come across this message when you try to build the project in “DebugRetract” or “DebugDelete” build targets.

If you take a look at the output windows it fails at line:

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm.exe" -o retractsolution -name Play.wsp -immediate

This happens because we haven’t specified the site collection URL that we had deployed the wsp solution to. So, if we change the line to.

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm.exe" -o retractsolution -name Play.wsp -immediate -url $(TargetUrl)

Remember to close and reopen your solution for this change to take effect, then build it. You should see the problem go away.

#5. Can’t Debug I hear you say?

There are a couple of things you need to do here,

One is, allows a pdb file to be generated each time you compile the project. in Visual Studio 2008, right click on the project -> Properties -> Build -> Advanced… -> Debug Info -> full

image

So repeat this for all the concerned Configuration target. I recommend do it for “DebugRefreshAssemblyInGac, DebugBuild, DebugDeploy, and DebugRedeploy”. Not sure about “DebugUpgrade” never used it before.

image

Two is adding the pdb files to the correct GAC location. First you’ll need to find out where in GAC you’ll want to copy the pdb files into.

Start -> Run and type in “C:\windows\assembly\GAC_MSIL” as it can’t be opened through a file explorer.

image

Follow your nose and you should find the directory where the bit was deployed to, copy out the path from Address bar, this is the folder you want to deploy your pdb file to.

image

So in your target file, you need add two lines to your “DebugDeploy” target and “DebugRefreshAssemblyInGac” target like to following;

<Target Name="DebugDeploy" DependsOnTargets="DebugInstall">
  <Message Text="Deploying Solution..." Importance="high" />
  <Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate -allowgacdeployment -url $(TargetUrl) -force" />
  <Exec Command="$(STSADM) -o execadmsvcjobs" />
  <Copy SourceFiles="$(TargetDir)$(TargetName).pdb" DestinationFolder="C:\windows\assembly\GAC_MSIL\Play.0.0.0__abbe9e18e07720bf" SkipUnchangedFiles="" />
  <Message Text="$(TargetDir)$(TargetName).pdb copied to GAC for debugging." Importance="high" />
  <Exec Command="$(POSTBUILD)" />
  <Message Text="" Importance="high" />
</Target>

<Target Name="DebugRefreshAssemblyInGac" >
  <Message Text="(Re)installing assembly in GAC and recycling app pool" Importance="high" />
  <Exec Command="$(GACUTIL) -if $(TargetPath)" />
  <Copy SourceFiles="$(TargetDir)$(TargetName).pdb" DestinationFolder="C:\windows\assembly\GAC_MSIL\Play.0.0.0__abbe9e18e07720bf" SkipUnchangedFiles="" />
  <Message Text="$(TargetDir)$(TargetName).pdb copied to GAC for debugging." Importance="high" />
  <Exec Command='$(ISSAPP_SCRIPT) /a "SharePoint - 80" /r' />
  <Message Text="" Importance="high" />
</Target>

Remember to close and reopen your solution each time you change the target file.

image

Make sure the timestamp for these two files are identical, or your code is likely to be out of sync with the pdb.

#6. Have a post build script depending on your build targets?

In your target file, add a new property inside <PropertyGroup> tag.

<POSTBUILD>"$(ProjectDir)PostBuild.bat"</POSTBUILD>

And use this as a command in any targets in your target file, like so;

<Exec Command="$(POSTBUILD)" />

– I hear you ask, why wouldn’t you just use Build Event from project properties?
Because STSDEV introduces a handful of build targets (10 of them) and sometimes it’s useful to have control over which targets you want to have a post build script while not others. Also, we can run different post build scripts for different build targets leveraging this approach, just define different scripts as properties inside <PropertyGroup> tag then just invoke the appropriate ones from different build targets.

– Note, in theory we should be able to put anything we have in a post build script in the target file. After all, the targets file is just a script file in an XML format. But to me, I want to be able to share my build script around with other developers or from project to project. By extracting some of the common tasks out to a build script I’m protecting myself against having to relying on STSDEV. After all, STSDEV is just one of the great tools out there. That’s just my opinion, your mileage may vary.

#7. Have multiple projects under one solution?

When you first create a project with STSDEV and call it Play, It will lay out its folder structure like so;

image

When you create more than one projects and shift them to a sub directory to where the solution file resides, like so;

image

Then you compile your project, you’ll see this error;

image

and this in your Output Window;

STSDEV - Simple Tools for SharePoint Developers
Refreshing Solution Package Files
Current Solution Name:
Current Solution Directory:
Refreshing deployment files...

Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Dev\Play\Play\DeploymentFiles\SolutionConfig.xml'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path)
   at stsdev.SolutionConfigBuilder.Create(String FilePath, Boolean AssemblyDeployment, Boolean SafeControlSettings, AssemblyDeploymentTarget DeploymentTarget, PermissionSet CasPermissions)
   at stsdev.SolutionConfigBuilder.Create(String FilePath, Boolean AssemblyDeployment, Boolean SafeControlSettings, AssemblyDeploymentTarget DeploymentTarget)
   at stsdev.SolutionConfigBuilder.Create(String FilePath, Boolean AssemblyDeployment, Boolean SafeControlSettings)
   at stsdev.SolutionConfigBuilder.Create(String FilePath, Boolean AssemblyDeployment)
   at stsdev.SolutionBuilder.LoadSolutionConfigFile()
   at stsdev.SolutionBuilder.RefreshDeploymentFiles()
   at stsdev.SolutionBuilder.RefreshDeploymentFiles(String TargetSolutionName, String TargetSolutionDirectory)
   at stsdev.Program.Main(String[] args)
MSBUILD : warning MSB3073: The command ""C:\Program Files\STSDev v1.3\stsdev.exe" /refresh "Play" "C:\Dev\Play\Play\"" exited with code -532459699.

This happens because, STSDEV uses solution directory to reference its deployment files and these files are per-project based. When we moved the project related files and folders else where, we’ll need to reference them by project directory.

All you need to do is to change the follow line in your <PropertyGroup> in your targets file.

<REFRESH>$(STSDEV) /refresh "$(TargetName)" "$(SolutionDir)"</REFRESH>

to

<REFRESH>$(STSDEV) /refresh "$(TargetName)" "$(ProjectDir)"</REFRESH>

Close and reopen the solution then try building the project again!

#8: “error : Cannot create INF file: setup.inf”

This happens because STSDEV will try to create/write to files called setup.inf andsetup.rpt. The chances are you have these two files under source control so they are locked.

setup.infsetup.rpt in project directory, along with manifest.xml andSolutionPackage.ddf in DeploymentFiles folder will get regenerated and written to each time you build your project. So don’t have them under source control.

image

#9: “Where are my web stuff?”

Enlightened by a colleague of mine – Matt Smith – a SharePoint Evangelist. When you create a project with STSDEV, the project is a C# library type.

image

When we add New Items, there isn’t a great of items are available to us. Especially when we develop SharePoint solutions, ASP.NET artifacts like ascx User Controls, aspx pages etc…

image

For us to be able to add web stuff to the project, Visual Studio needs to see the project we are adding stuff to – is a Web Application Project. To achieve this, add the following line of xml to the first <PropertyGroup> node of your .csproj file.

<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

So,

<PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">DebugBuild</Configuration>
  <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  <ProductVersion>9.0.21022</ProductVersion>
  <SchemaVersion>2.0</SchemaVersion>
  <ProjectGuid>{3C135253-DDB3-421F-B27A-FC0481335E58}</ProjectGuid>
  <OutputType>Library</OutputType>
  <RootNamespace>Play</RootNamespace>
  <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
  <SignAssembly>true</SignAssembly>
  <AssemblyOriginatorKeyFile>KeyFile.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

becomes

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <Configuration Condition=" '$(Configuration)' == '' ">DebugBuild</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{3C135253-DDB3-421F-B27A-FC0481335E58}</ProjectGuid>
    <OutputType>Library</OutputType>
    <RootNamespace>Play</RootNamespace>
    <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>KeyFile.snk</AssemblyOriginatorKeyFile>
  </PropertyGroup>

Reload the project and we see the project icon has become it of a Web Application Project;

image

and we can add all the web stuff to our project now;

image

There you go, the joys and pains for working with STSDEV.

Issues Deploying SharePoint Solution Packages

Creating the WSP file was quite straightforward, as was adding it to the solution store, using the following command:

stsadm -o addsolution -filename Fabrikam.Project1.PublishingLayouts.wsp

However, as soon as I tried to deploy the solution using the following command:

stsadm -o deploysolution -name Fabrikam.Project1.PublishingLayouts -url http://foobar/ -local

I encountered the following error:

This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

I must have spent 30 minutes trying to figure out why this command did not work (because it worked just fine for other features that I had converted to deploy with WSPs). It turns out that I needed to omit the url parameter:

stsadm -o deploysolution -name Fabrikam.Project1.PublishingLayouts -local

The reason why the PublishingLayouts solution would not deploy with the url parameter is because, unlike the other features, there was no assembly generated for the PublishingLayouts (since it was pure content).

I also encountered the following error when trying to deploy our custom Workflows feature:

Elements of type ‘Workflow’ are not supported at the ‘WebApplication’ scope.  This feature could not be installed.

I found that I had to omit the url parameter for this solution as well.

I then decided to try omitting the url parameter when deploying all of the other solutions. Without the urlparameter, I was able to deploy 7 of our 9 features. The remaining two produced the following error:

This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.

For these two features, I had to specify the url parameter when invoking stsadm.exe, because the manifest.xml file for the WSP specifies a <SafeControl> element. When deploying these two solutions, SharePoint needs to know which Web.config file to merge the <SafeControl> elements into, and therefore the url parameter must be specified.

The bottom line is that if your solution specifies elements (a.k.a. “resources”) that need to be merged into a Web.config file (i.e. “for a Web application”) then you must specify the url parameter. If your solution does not have an assembly or if your solution contains workflows, then you cannot specify the url parameter.