Tuesday, November 16, 2010

Coding Standards with Example for C++ and C#


Coding Standards C & C#

Friday, October 15, 2010

SharePoint STSADM Commands


  1. stsadm -o activatefeature {-filename | -name | -id } [-url ] [-force]
  2. stsadm -o activateformtemplate -url [-formid
    ] [-filename ]
  3. stsadm -o addalternatedomain -url -incomingurl -urlzone -resourcename
  4. stsadm -o addcontentdb -url -databasename [-databaseserver ] [-databaseuser ] [-databasepassword ] [-sitewarning ] [-sitemax ]
  5. stsadm -o adddataconnectionfile -filename [-webaccessible ] [-overwrite ] [-category ]
  6. stsadm -o add-ecsfiletrustedlocation -Ssp -Location -LocationType SharePoint|Unc|Http -IncludeChildren True|False [-SessionTimeout
  7. stsadm -o add-ecssafedataprovider -Ssp -ID -Type Oledb|Odbc|OdbcDsn [-Description ]
  8. stsadm -o add-ecstrusteddataconnectionlibrary -Ssp -Location [-Description ]
  9. stsadm -o add-ecsuserdefinedfunction -Ssp -Assembly -AssemblyLocation GAC|File [-Enable True|False] [-Description ]
  10. stsadm -o addexemptuseragent -name
  11. stsadm -o addpath -url -type
  12. stsadm -o addpermissionpolicy -url -userlogin -permissionlevel [-zone ] [-username ]
  13. stsadm -o addsolution -filename [-lcid ]
  14. stsadm -o addtemplate -filename
  15. stsadm -o adduser -url -userlogin -useremail <someone@example.com> -role / -group -username [-siteadmin]
  16. stsadm -o addwppack  -filename [-lcid ] [-url ] [-globalinstall] [-force] [-nodeploy]
  17. stsadm -o addwppack  -name [-lcid ] [-url ] [-globalinstall] [-force]
  18. stsadm -o addzoneurl -url -urlzone -zonemappedurl -resourcename
  19. stsadm -o allowuserformwebserviceproxy -url -enable
  20. stsadm -o allowwebserviceproxy -url -enable
  21. stsadm -o associatewebapp -title [-default | -parent] -url [-all]
  22. stsadm -o authentication -url -type [-usebasic (valid only in windows authentication mode)] [-usewindowsintegrated (valid only in windows authentication mode)] [-exclusivelyusentlm (valid only in windows authentication mode)] [-membershipprovider ] [-rolemanager ] [-enableclientintegration] [-allowanonymous]
  23. stsadm -o backup -url -filename [-overwrite]
  24. stsadm -o backup -directory -backupmethod [-item ] [-percentage ] [-backupthreads ] [-showtree] [-quiet]
  25. stsadm -o backuphistory -directory [-backup] [-restore]
  26. stsadm -o binddrservice -servicename -setting
  27. stsadm -o blockedfilelist -extension -add [-url ]
  28. stsadm -o blockedfilelist -extension -delete [-url ]
  29. stsadm -o canceldeployment -id
  30. stsadm -o changepermissionpolicy -url -userlogin [-zone ] [-username ] [{ -add | -delete } -permissionlevel ]
  31. stsadm -o copyappbincontent
  32. stsadm -o createadminvs [-admapidname ] [-admapidtype ] [-admapidlogin ] [-admapidpwd ]
  33. stsadm -o createcmsmigrationprofile -profilename [-description ] [-connectionstring ] -databaseserver   -databasename   -databaseuser   [-databasepassword ] [-auth windowsauth|sqlauth] -destination [-rootchannel ] [-destinationlocale ] [-migrateresources onlyused|all] [-migrateacls yes|no] [-emailto ] [-emailon success|failure|none|both] [-keeptemporaryfiles Never|Always|Failure] [-enableeventreceivers yes|no]
  34. stsadm -o creategroup -url -name -description -ownerlogin [-type member|visitor|owner]
  35. stsadm -o createsite -url -owneremail <someone@example.com> [-ownerlogin ] [-ownername ] [-secondaryemail <someone@example.com>] [-secondarylogin ] [-secondaryname ] [-lcid ] [-sitetemplate ] [-title ] [-description ] [-hostheaderwebapplicationurl ] [-quota ]
  36. stsadm -o createsiteinnewdb -url -owneremail <someone@example.com> [-ownerlogin ] [-ownername ] [-secondaryemail <someone@example.com>] [-secondarylogin ] [-secondaryname ] [-lcid ] [-sitetemplate ] [-title ] [-description ] [-hostheaderwebapplicationurl ] [-quota ] [-databaseuser ] [-databasepassword ] [-databaseserver ] [-databasename ]
  37. stsadm -o createssp -title -url -mysiteurl -ssplogin -indexserver -indexlocation [-ssppassword ] [-sspdatabaseserver ] [-sspdatabasename ] [-sspsqlauthlogin ] [-sspsqlauthpassword ] [-searchdatabaseserver ] [-searchdatabasename ] [-searchsqlauthlogin ] [-searchsqlauthpassword ] [-ssl ]
  38. stsadm -o createweb -url [-lcid ] [-sitetemplate ] [-title ] [-description ] [-convert] [-unique]
  39. stsadm -o databaserepair -url -databasename [-deletecorruption]
  40. stsadm -o deactivatefeature {-filename | -name | -id } [-url ] [-force]
  41. stsadm -o deactivateformtemplate -url [-formid ] [-filename ]
  42. stsadm -o deleteadminvs
  43. stsadm -o deletealternatedomain -url -incomingurl
  44. stsadm -o deletecmsmigrationprofile -profilename
  45. stsadm -o deleteconfigdb
  46. stsadm -o deletecontentdb -url -databasename [-databaseserver ]
  47. stsadm -o deletegroup -url -name
  48. stsadm -o deletepath -url
  49. stsadm -o deletepermissionpolicy -url -userlogin [-zone ]
  50. stsadm -o deletesite -url -deleteadaccounts
  51. stsadm -o deletesolution -name [-override] [-lcid ]
  52. stsadm -o deletessp -title [-deletedatabases]
  53. stsadm -o deletessptimerjob -title -jobid
  54. stsadm -o deletetemplate -title
  55. stsadm -o deleteuser -url -userlogin [-group ]
  56. stsadm -o deleteweb -url
  57. stsadm -o deletewppack -name [-lcid ] [-url ]
  58. stsadm -o deletezoneurl -url -urlzone -resourcename
  59. stsadm -o deploysolution -name [-url ] [-allcontenturls] [-time
  60. stsadm -o deploywppack -name [-url ] [-time
  61. stsadm -o disablessc -url
  62. stsadm -o displaysolution -name
  63. stsadm -o editcmsmigrationprofile -profilename [-description ] [-connectionstring ] [-databaseserver ] [-databasename ] [-databaseuser ] [-databasepassword ] [-auth sqlauth|windowsauth] [-emailto ] [-emailon success|failure|none|both] [-excludeschema ] [-keeptemporaryfiles Never|Always|Failure] [-enableeventreceivers yes|no]
  64. stsadm -o editcontentdeploymentpath -pathname [-keeptemporaryfiles Never|Always|Failure] [-enableeventreceivers yes|no] [-enablecompression yes|no]
  65. stsadm -o editssp -title [-newtitle ] [-sspadminsite ] [-ssplogin ] [-ssppassword ] [-indexserver ] [-indexlocation ] [-setaccounts ] [-ssl ]
  66. stsadm -o email -outsmtpserver -fromaddress <someone@example.com> -replytoaddress <someone@example.com> -codepage [-url ]
  67. stsadm -o enablecmsurlredirect -profilename -off
  68. stsadm -o enablessc -url [-requiresecondarycontact]
  69. stsadm -o enumalternatedomains -url -resourcename
  70. stsadm -o enumcontentdbs -url
  71. stsadm -o enumdataconnectionfiledependants -filename
  72. stsadm -o enumdataconnectionfiles [-mode ]
  73. stsadm -o enumdeployments
  74. stsadm -o enumexemptuseragents
  75. stsadm -o enumformtemplates
  76. stsadm -o enumgroups -url
  77. stsadm -o enumroles -url
  78. stsadm -o enumservices
  79. stsadm -o enumsites -url -showlocks -redirectedsites
  80. stsadm -o enumsolutions
  81. stsadm -o enumssp -title [-default | -parent | -all]
  82. stsadm -o enumssptimerjobs -title
  83. stsadm -o enumsubwebs -url
  84. stsadm -o enumtemplates [-lcid ]
  85. stsadm -o enumusers -url
  86. stsadm -o enumwppacks [-name ] [-url ] [-farm]
  87. stsadm -o enumzoneurls -url -resourcename
  88. stsadm -o execadmsvcjobs
  89. stsadm -o export -url -filename [-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 (default: 25)] [-nofilecompression] [-quiet]
  90. stsadm -o extendvs -url -ownerlogin -owneremail <someone@example.com> [-exclusivelyusentlm] [-ownername ] [-databaseuser ] [-databaseserver ] [-databasename ] [-databasepassword ] [-lcid ] [-sitetemplate ] [-donotcreatesite] [-description ] [-sethostheader] [-apidname ] [-apidtype ] [-apidlogin ] [-apidpwd ] [-allowanonymous]
  91. stsadm -o extendvsinwebfarm -url -vsname [-exclusivelyusentlm] [-apidname ] [-apidtype ] [-apidlogin ] [-apidpwd ] [-allowanonymous]
  92. stsadm -o forcedeleteweb -url
  93. stsadm -o formtemplatequiescestatus [-formid ] [-filename ]
  94. stsadm -o getadminport
  95. stsadm -o getdataconnectionfileproperty -filename -pn
  96. stsadm -o getformsserviceproperty -pn
  97. stsadm -o getformtemplateproperty [-formid ] [-filename ] -pn
  98. stsadm -o getproperty -propertyname [-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
  101. stsadm -o geturlzone -url
  102. stsadm -o import -url -filename [-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]
  103. stsadm -o installfeature {-filename | -name } [-force]
  104. stsadm -o listlogginglevels [-showhidden]
  105. stsadm -o listregisteredsecuritytrimmers -ssp
  106. stsadm -o localupgradestatus
  107. stsadm -o managepermissionpolicylevel -url -name [{ -add | -delete }] [-description ] [-siteadmin ] [-siteauditor ] [-grantpermissions ] [-denypermissions ]
  108. stsadm -o migrateuser -oldlogin -newlogin [-ignoresidhistory]
  109. stsadm -o osearch [-action ] required parameters for 'start' (if not  already set): role, farmcontactemail, service credentials [-f (suppress prompts)] [-role ] [-farmcontactemail ] [-farmperformancelevel ] [-farmserviceaccount (service credentials)] [-farmservicepassword ] [-defaultindexlocation ] [-propagationlocation ]
  110. stsadm -o osearchdiacriticsensitive -ssp [-setstatus ] [-noreset] [-force]
  111. stsadm -o preparetomove {-ContentDB | -Site } [-OldContentDB ] [-undo]
  112. stsadm -o profilechangelog -title -daysofhistory -generateanniversaries
  113. stsadm -o profiledeletehandler -type
  114. stsadm -o provisionservice -action -servicetype [-servicename ]
  115. stsadm -o quiescefarm -maxduration
  116. stsadm -o quiescefarmstatus
  117. stsadm -o quiesceformtemplate [-formid ] [-filename ] -maxduration
  118. stsadm -o reconvertallformtemplates
  119. stsadm -o refreshdms -url
  120. stsadm -o refreshsitedms -url
  121. stsadm -o registersecuritytrimmer -ssp -id <0 - 2147483647> -typename -rulepath [-configprops ]
  122. stsadm -o registerwsswriter
  123. stsadm -o removedataconnectionfile -filename
  124. stsadm -o removedrservice -servicename -setting
  125. stsadm -o remove-ecsfiletrustedlocation -Ssp -Location -LocationType SharePoint|Unc|Http
  126. stsadm -o remove-ecssafedataprovider -Ssp -ID -Type Oledb|Odbc|OdbcDsn
  127. stsadm -o remove-ecstrusteddataconnectionlibrary -Ssp -Location
  128. stsadm -o remove-ecsuserdefinedfunction -Ssp -Assembly -AssemblyLocation GAC|File
  129. stsadm -o removeexemptuseragent -name
  130. stsadm -o removeformtemplate [-formid ] [-filename ]
  131. stsadm -o removesolutiondeploymentlock [-server [-allservers]
  132. stsadm -o renameserver -oldservername -newservername
  133. stsadm -o renameweb -url -newname
  134. stsadm -o restore -url -filename [-hostheaderwebapplicationurl ] [-overwrite]
  135. stsadm -o restore -directory -restoremethod [-backupid ] [-item ] [-percentage ] [-showtree] [-suppressprompt] [-username ] [-password ] [-newdatabaseserver ] [-quiet]
  136. stsadm -o restoressp -title -url -ssplogin -mysiteurl -indexserver -indexlocation [-keepindex] -sspdatabaseserver -sspdatabasename [-ssppassword ] [-sspsqlauthlogin ] [-sspsqlauthpassword ] [-searchdatabaseserver ] [-searchdatabasename ] [-searchsqlauthlogin ] [-searchsqlauthpassword ] [-ssl ]
  137. stsadm -o retractsolution -name [-url ] [-allcontenturls] [-time
  138. stsadm -o retractwppack -name [-url ] [-time
  139. stsadm -o runcmsmigrationprofile -profilename [-skipanalyzer ] [-onlyanalyzer ] [-startover ] [-migratesincetime ] [-migrationfolder ] [-exportonly ] [-importonly ] [-htmldiff ]
  140. stsadm -o runcontentdeploymentjob -jobname [-wait yes|no] [-deploysincetime ] ( as "MM/DD/YY HH:MM:SS")
  141. stsadm -o scanforfeatures [-solutionid ] [-displayonly]
  142. stsadm -o setadminport -port [-ssl] [-admapcreatenew] [-admapidname ]
  143. stsadm -o setapppassword -password
  144. stsadm -o setbulkworkflowtaskprocessingschedule -schedule
  145. stsadm -o setconfigdb [-connect] -databaseserver [-databaseuser ] [-databasepassword ] [-databasename ] [-exclusivelyusentlm] [-farmuser] [-farmpassword] [-adcreation] [-addomain ] [-adou ]
  146. stsadm -o setcontentdeploymentjobschedule -jobname -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")
  147. stsadm -o setdataconnectionfileproperty -filename -pn -pv
  148. stsadm -o setdefaultssp -title
  149. stsadm -o set-ecsexternaldata -Ssp [-ConnectionLifetime
  150. stsadm -o set-ecsloadbalancing -Ssp [-Scheme WorkbookUrl|RoundRobin|Local] [-RetryInterval
  151. stsadm -o set-ecsmemoryutilization -Ssp [-MaxPrivateBytes ] [-MemoryCacheThreshold ] [-MaxUnusedObjectAge
  152. stsadm -o set-ecssecurity -Ssp [-FileAccessMethod UseImpersonation|UseFileAccessAccount] [-AccessModel Delegation|TrustedSubsystem] [-RequireEncryptedUserConnection False|True] [-AllowCrossDomainAccess True|False]
  153. stsadm -o set-ecssessionmanagement -Ssp [-MaxSessionsPerUser ]
  154. stsadm -o set-ecsworkbookcache -Ssp [-Location ] [-MaxCacheSize ] [-EnableCachingOfUnusedFiles True|False]
  155. stsadm -o setformsserviceproperty -pn -pv
  156. stsadm -o setformtemplateproperty [-formid ] [-filename ] -pn -pv
  157. stsadm -o setholdschedule -schedule
  158. 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>] }
  159. stsadm -o setpolicyschedule -schedule
  160. stsadm -o setproperty -propertyname -propertyvalue [-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)
  161. stsadm -o setrecordsrepositoryschedule -schedule
  162. stsadm -o setsearchandprocessschedule -schedule
  163. stsadm -o setsharedwebserviceauthn -ntlm | -negotiate
  164. stsadm -o setsitedirectoryscanschedule -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")
  165. stsadm -o setsitelock -url -lock
  166. stsadm -o setsspport -httpport -httpsport
  167. stsadm -o setworkflowconfig -url {-emailtonopermissionparticipants | -externalparticipants | -userdefinedworkflows }
  168. stsadm -o siteowner -url [-ownerlogin ] [-secondarylogin ]
  169. stsadm -o spsearch [-action ] [-f (suppress prompts)] [-farmperformancelevel ] [-farmserviceaccount (service credentials)] [-farmservicepassword ] [-farmcontentaccessaccount ] [-farmcontentaccesspassword ] [-indexlocation ] [-databaseserver (default: josebda-moss)] [-databasename (default: SharePoint_WSS_Search)] [-sqlauthlogin ] [-sqlauthpassword ] -action list -action stop [-f (suppress prompts)] -action start -farmserviceaccount (service credentials) [-farmservicepassword ] -action attachcontentdatabase [-databaseserver (default: josebda-moss)] -databasename [-searchserver (default: josebda-moss)] -action detachcontentdatabase [-databaseserver (default: josebda-moss)] -databasename [-f (suppress prompts)] -action fullcrawlstart -action fullcrawlstop
  170. stsadm -o spsearchdiacriticsensitive [-setstatus ] [-noreset] [-force]
  171. stsadm -o sync {-ExcludeWebApps | -SyncTiming | -SweepTiming | -ListOldDatabases | -DeleteOldDatabases }
  172. stsadm -o syncsolution -name ] [-lcid ] [-alllcids]
  173. stsadm -o syncsolution -allsolutions
  174. stsadm -o unextendvs -url [-deletecontent] [-deleteiissites]
  175. stsadm -o uninstallfeature {-filename | -name | -id } [-force]
  176. stsadm -o unquiescefarm
  177. stsadm -o unquiesceformtemplate [-formid ] [-filename ]
  178. stsadm -o unregistersecuritytrimmer -ssp -id <0 - 2147483647>
  179. stsadm -o unregisterwsswriter
  180. stsadm -o updateaccountpassword -userlogin -password [-noadmin]
  181. stsadm -o updatealerttemplates -url [-filename ] [-lcid
  182. stsadm -o updatefarmcredentials [-identitytype ] [-userlogin ] [-password ] [-local [-keyonly]]
  183. stsadm -o upgrade {-inplace | -sidebyside} [-url ] [-forceupgrade] [-quiet] [-farmuser ] [-farmpassword ] [-reghost] [-sitelistpath ]
  184. stsadm -o upgradeformtemplate -filename [-upgradetype ]
  185. stsadm -o upgradesolution -name -filename [-time
  186. stsadm -o upgradetargetwebapplication -url -relocationurl -apidname [-apidtype ] [-apidlogin ] [-apidpwd ] [-exclusivelyusentlm]
  187. stsadm -o uploadformtemplate -filename
  188. stsadm -o userrole -url -userlogin -role [-add] [-delete]
  189. stsadm -o verifyformtemplate -filename

Thursday, September 23, 2010

Create new site programmatically in workflow

private void codeActivity1_ExecuteCode(object sender, EventArgs e)
        {
            SPWeb web = workflowProperties.Web;
            SPSite site = workflowProperties.Site;
            SPListItem lst = workflowProperties.Item;
            string title = lst["Title"].ToString();
            string url = title.Replace(' ', '-');
            if (!web.Webs["title"].Exists)
            {
                SPWeb wb = web.Webs.Add(url);
                lst["weburl"] = wb.Url;
                lst.Update();
                web.Update();
            }
            

        }

Monday, September 13, 2010

Add and Remove user in SharePoint Group


Add and Remove user in SharePoint Group

Friday, September 3, 2010

Web.Config Overview for Beginners


Web.Config Overview

Thursday, August 5, 2010

Monday, August 2, 2010

What is Application-Website Dashboard?


A Dashboard is the over view of the particular site's/user's details. Dashboard is steering for the user. Dashboards show visualizations of your data such as charts and graphs and are extremely useful for displaying the results of reports and searches.

Use dashboards to highlight interesting and useful aspects of your data, link to important searches and display common reports.

Information displayed on the dashboard should be reflecting the current value (for reports/charts). So that user can notice every change at a glance by that user can get any decision early. Dashboard should not be filling with only reports. a dashboard is a form of report, but not all reports are dashboards

Dashboard is one type of the Railway Station. Where user come get train detail and travel if he/she wants. In easy words user should get all the details and links in the dashboard so user can travel to the destination (required page) via dashboard.

Dashboard contains Charts, Tables, Links, Reports, notifications etc.

Source: http://www.codeproject.com/KB/architecture/DashboardsAreForDriving.aspx

Thursday, June 17, 2010

Excel all Worksheet Column Case Change Macro

Sub UpCase()

Dim dbSheet As Worksheet
Dim LastRowColC
For i = 1 To Worksheets.Count
    Set dbSheet = Worksheets(i)
    LastRowColC = dbSheet.Range("B" + CStr(dbSheet.Rows.Count)).End(xlUp).Row
    For j = 1 To LastRowColC
        dbSheet.Cells(j, "B").Value = StrConv(dbSheet.Cells(j, "B").Value, vbUpperCase)
    Next j
Next i
End Sub

Friday, May 7, 2010

Read CSV with oledb to dataset - datatable

string csvDirectory = Server.MapPath("~/media/");
        string CsvFile = "SampleDirectory.csv";
        DataSet ds = new DataSet();
        OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + csvDirectory + ";Extended Properties='text;HDR=Yes;FMT=Delimited'");
        OleDbDataAdapter ExcelAdapter = new OleDbDataAdapter("SELECT * FROM " + CsvFile, con);
        con.Open();
        ExcelAdapter.Fill(ds);
        con.Close();
        GridView1.DataSource = ds;
        GridView1.DataBind();

Resize Image with javascript

function resizeImageByWidth(img,MaxWidth) {
    try {
        if (img != null && img.src != "") {
            img.attributes.removeNamedItem("width");
            img.attributes.removeNamedItem("height");

            var oW = img.width;
            var oH = img.height;

            if (oW > MaxWidth) {
                var rW = parseFloat(oW) / parseFloat(MaxWidth);
                img.width = parseInt(oW / rW);
                img.height = parseInt(oH / rW);
            }
        }
    }
    catch (ex) {
        img.width = MaxWidth;
    }
}

function resizeImage(img, maxHeight, MaxWidth) {
    try {
        if (img != null && img.src != "") {
            img.attributes.removeNamedItem("width");
            img.attributes.removeNamedItem("height");

            var oW = img.width;
            var oH = img.height;

            if (oW > MaxWidth || oH > maxHeight) {
                var rW = parseFloat(oW) / parseFloat(MaxWidth);
                var rH = parseFloat(oH) / parseFloat(maxHeight);
                var ratio = Math.max(rW, rH);
                img.width = parseInt(oW / ratio);
                img.height = parseInt(oH / ratio);
            }
        }
    }
    catch (ex) {
        img.height = maxHeight;
        img.width = MaxWidth;
    }
}
To use in the image just add onload event event on image


any size is given automatically removed.

Thursday, May 6, 2010

Convert decimal to currency format string

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CurrnecyDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal money = 200m;
            CurrencyTranslator currencyTranslator = new CurrencyTranslator();
            string currency = currencyTranslator.TranslateCurrency(money, "Rupee", "Paisa");
        }
    }

    public class CurrencyTranslator
    {
        // Array of sting to hold the words from one to nineteen
        private string[] _arrayOfOnes = { string.Empty, "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", 
"Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen",
"Nineteen" };
        // Array of string to hold the words of tens - 10, 20,.., 90
        private string[] _arrayOfTens = { string.Empty , "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty",
"Seventy", "Eighty", "Ninety"};

        // Converts the decimal to currency
        public string TranslateCurrency(decimal currencyValue, string dollarString, string centString)
{
string numericCurrency = currencyValue.ToString().Trim();
//Check for the max capacity limit of the input
if (numericCurrency.Length > 18)
return "Invalid input format";

string leftValue, decimalWord;
//Right align the charecters with padding of "0" to length the of 18 charecters
if (numericCurrency.IndexOf(".") >= 0)
{
leftValue = numericCurrency.Substring(0, numericCurrency.IndexOf(".")).PadLeft(18, Convert.ToChar("0"));
decimalWord = numericCurrency.Substring(numericCurrency.IndexOf(".") + 1).PadRight(2, Convert.ToChar("0"));
decimalWord = (decimalWord.Length > 2 ? decimalWord.Substring(0, 2) : decimalWord);
}
else
{
leftValue = numericCurrency.PadLeft(18, Convert.ToChar("0"));
decimalWord = "0";
}

string quadrillionWord, trillionWord, billionWord, millionWord, thousandWord, hundredWord;
quadrillionWord = TranslateHundreds(Convert.ToInt32(leftValue.Substring(0, 3))); // One Quadrillion - Number of zeros 15
trillionWord = TranslateHundreds(Convert.ToInt32(leftValue.Substring(3, 3))); // One Trillion - Number of zeros 12
billionWord = TranslateHundreds(Convert.ToInt32(leftValue.Substring(6, 3))); // One Billion - Number of zeros 9
millionWord = TranslateHundreds(Convert.ToInt32(leftValue.Substring(9, 3))); // One Million - Number of zeros 6
thousandWord = TranslateHundreds(Convert.ToInt32(leftValue.Substring(12, 3)));
hundredWord = TranslateHundreds(Convert.ToInt32(leftValue.Substring(15, 3)));
decimalWord = TranslateDecimal(decimalWord);

// Start building the currency
StringBuilder currencyInEnglish = new StringBuilder();
currencyInEnglish.Append((quadrillionWord.Trim() == string.Empty ? string.Empty : quadrillionWord + " Quadrillion "));
currencyInEnglish.Append((trillionWord.Trim() == string.Empty ? string.Empty : trillionWord + " Trillion "));
currencyInEnglish.Append((billionWord.Trim() == string.Empty ? string.Empty : billionWord + " Billion "));
currencyInEnglish.Append((millionWord.Trim() == string.Empty ? string.Empty : millionWord + " Million "));
currencyInEnglish.Append((thousandWord.Trim() == string.Empty ? string.Empty : thousandWord + " Thousand "));
currencyInEnglish.Append((hundredWord.Trim() == string.Empty ? string.Empty : hundredWord));

currencyInEnglish.Append(currencyInEnglish.ToString() == string.Empty ? string.Format("Zero {0}s ", dollarString) : string.Format(" {0}s", dollarString));
if (currencyInEnglish.ToString().StartsWith(string.Format("One {0}s", dollarString)))
{
currencyInEnglish.Replace(string.Format("One {0}s", dollarString), string.Format("One {0}", dollarString));
}
currencyInEnglish.Append((decimalWord == string.Empty ? string.Format(" and Zero {0}", centString) : " and " + decimalWord + string.Format(" {0}", centString)));
return currencyInEnglish.ToString();
}


        #region Private Functions


        private string TranslateHundreds(int value)
{
string result;
// If the value is less than hundred then convert it as tens
if (value <= 99)

{
result = (TranslateTens(value));
}
else
{
result = _arrayOfOnes[Convert.ToInt32(Math.Floor(Convert.ToDecimal(value / 100)))];
// Math.Floor method is used to get the largest integer from the decial value
result += " Hundred ";
// The rest of the decimal is converted into tens
if (value - Math.Floor(Convert.ToDecimal((value / 100) * 100)) == 0)
{
result += string.Empty;
}
else
{
result += string.Empty + TranslateTens(Convert.ToInt32(value - Math.Floor(Convert.ToDecimal((value / 100) * 100))));
}
}
return result;
}


        private string TranslateTens(int value)
{
string result;
// If the value is less than 20 then get the word directly from the array
if (value < 20)

{
result = _arrayOfOnes[value];
value = 0;
}
else
{
result = _arrayOfTens[(int)Math.Floor(Convert.ToDecimal(value / 10))];
value -= Convert.ToInt32(Math.Floor(Convert.ToDecimal((value / 10) * 10)));
}
result = result + (_arrayOfOnes[value].Trim() == string.Empty ? string.Empty : "-" + _arrayOfOnes[value]);
return result;
}

        // Translates the decimal part of the currency to words
        private string TranslateDecimal(string value)
        {
            string result = string.Empty;
            // Check whether the decimal part starts with a zero. Example : 12.05
            if (value != "0")
            {
                if (value.StartsWith("0"))
                {
                    result = "Zero ";
                    result += _arrayOfOnes[Convert.ToInt32(value.Substring(1, 1))];
                }
                else
                {
                    result = TranslateTens(Convert.ToInt32(value));
                }

            }
            return result;
        }
        #endregion
    }
}

Saturday, April 24, 2010

Resize Image High Quality C#.Net with Size Ratio and File Upload Control

public bool SaveThumbnailImageHQ(System.Web.UI.WebControls.FileUpload fu, string FullSavePath, int HeightMax, int WidthMax)
{
    try
    {
        if (fu.HasFile)
        {
            Size newSize = new Size(WidthMax, HeightMax);
            using (Bitmap bmp = new Bitmap(fu.PostedFile.InputStream))
            {
                double ratioWidth = (double)bmp.Size.Width / (double)newSize.Width;
                double ratioHeight = (double)bmp.Size.Height / (double)newSize.Height;
                double ratio = Math.Max(ratioHeight, ratioWidth);
                int newWidth = (int)(bmp.Size.Width / ratio);
                int newHeight = (int)(bmp.Size.Height / ratio);
                newSize = new Size(newWidth, newHeight);
                using (Bitmap thumb = new Bitmap((System.Drawing.Image)bmp, newSize))
                {
                    using (Graphics g = Graphics.FromImage(thumb)) // Create Graphics object from original Image
                    {
                        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                        g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
                        g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                        System.Drawing.Imaging.ImageCodecInfo codec = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()[1];
                        System.Drawing.Imaging.EncoderParameters eParams = new System.Drawing.Imaging.EncoderParameters(1);
                        eParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
                        g.DrawImage(bmp, new Rectangle(0, 0, thumb.Width, thumb.Height));
                        if (System.IO.File.Exists(FullSavePath))
                        {
                            try { System.IO.File.Delete(FullSavePath); }
                            catch { }
                        }
                        thumb.Save(FullSavePath, codec, eParams);
                        //setError(false, string.Empty);
                        return true;
                    }
                }
            }
        }
        else
        {
            //setError(true, "No file input found.");
            return false;
        }
    }
    catch (Exception ex)
    {
        //setError(true, ex.Message);
        return false;
    }
}

Monday, April 19, 2010

All Font Preview Microsoft Word Macro

Sub Generate_Font_Preview()
Dim doc As Word.Document
Dim objRange As Range
Dim oTable  As Word.Table
Dim iCnt  As Integer
Dim s1 As Range
Dim str As String

Set doc = Application.Documents.Add
Set objRange = doc.Range()
str = InputBox("Please enter Preview Text", "Preview Text")

doc.Tables.Add objRange, Application.FontNames.Count, 2
Set oTable = doc.Tables(1)


For iCnt = 1 To FontNames.Count
    If (IsEmpty(str)) Then
        str = Application.FontNames(iCnt)
    End If
    oTable.Cell(iCnt, 1).Range.Text = Application.FontNames(iCnt)
    oTable.Cell(iCnt, 1).SetWidth ColumnWidth:=InchesToPoints(1.5), RulerStyle:=wdAdjustSameWidth
    With oTable.Cell(iCnt, 2).Range
        .Text = str
        .Font.Name = Application.FontNames(iCnt)
        .Font.Size = 25
        .Font.Color = WdColor.wdColorBlack
    End With
Next iCnt
End Sub

Wednesday, April 7, 2010

Split string-value with delimeter in Sql Server via XML

Declare @xml as xml
declare @str as varchar(100)
declare @delimiter as varchar(10)
SET @str=',A,B,C,D,E,,,'
SET @delimiter =','
SET @xml = cast((''+replace(@str,@delimiter ,'')+'') as xml)
select @xml
SELECT N.value('.', 'varchar(max)') as value 
FROM @xml.nodes('x') as T(N) where N.value('.', 'varchar(max)')<>''

Wednesday, March 3, 2010

Master Page - Content Page Life Cycle

  1. Content page PreInit event.
  2. Master page controls Init event.
  3. Content controls Init event.
  4. Master page Init event.
  5. Content page Init event.
  6. Content page Load event.
  7. Master page Load event.
  8. Master page controls Load event.
  9. Content page controls Load event.
  10. Content page PreRender event.
  11. Master page PreRender event.
  12. Master page controls PreRender event.
  13. Content page controls PreRender event.
  14. Master page controls Unload event.
  15. Content page controls Unload event.
  16. Master page Unload event.
  17. Content page Unload event.
  18. The sequence of events in master