Tuesday, January 31, 2012
Monday, January 30, 2012
Powershell Delete Unused WF Column
This script works as a function – meaning that there are two parts to running it in the SharePoint 2010 Management Shell. First, you have to run the script shown below:
function Delete-WorkflowColumn ($webURL, $listName, $columnName)
{
#Setup variables from the user input
$web = Get-SPWeb $webURL
$list = $web.Lists[$listName]
$column = $list.Fields[$columnName]
#Make sure the column is not hidden or read only
$column.Hidden = $false
$column.ReadOnlyField = $false
$column.Update()
#Delete column and dispose of the web object
$list.Fields.Delete($column)
write-host "Deleted column"
$web.Dispose()
}
Once the function has been run, you can call it to actually remove a column with the following command:
Delete-WorkflowColumn -webURL http://portal -listName "Documents" -columnName "Approval Workflow"
The example above deletes the “Approval Workflow” column from all list views of a document library called “Documents” in the site http://portal/.
Whilst I have focused in this article on removing columns generated by unused workflows, you can use exactly the same script to remove columns from any list or document library.
function Delete-WorkflowColumn ($webURL, $listName, $columnName)
{
#Setup variables from the user input
$web = Get-SPWeb $webURL
$list = $web.Lists[$listName]
$column = $list.Fields[$columnName]
#Make sure the column is not hidden or read only
$column.Hidden = $false
$column.ReadOnlyField = $false
$column.Update()
#Delete column and dispose of the web object
$list.Fields.Delete($column)
write-host "Deleted column"
$web.Dispose()
}
Once the function has been run, you can call it to actually remove a column with the following command:
Delete-WorkflowColumn -webURL http://portal -listName "Documents" -columnName "Approval Workflow"
The example above deletes the “Approval Workflow” column from all list views of a document library called “Documents” in the site http://portal/.
Whilst I have focused in this article on removing columns generated by unused workflows, you can use exactly the same script to remove columns from any list or document library.
Labels:
Nintex,
PowerShell,
SharePoint
Friday, January 27, 2012
Wednesday, January 25, 2012
Track downloaded files/links in Google Analytics
Link to Article
In href tag include onclick:
In href tag include onclick:
<a href=http://www.example.com/files/map.pdf onClick="javascript: _gaq.push(['_trackPageview', '/files/map.pdf']);">
Labels:
Development,
SharePoint,
Website
Tuesday, January 24, 2012
Stsadm Commands
Export/Import
stsadm.exe -o export -url http://localhost/ -filename C:\Export.cab -includeusersecurity -versions 4 -overwrite
stsadm.exe -o import -url http://localhost/ -filename C:\Export.cab -includeusersecurity
Can export/import sub-sites with this method (i.e. http://portal/Communities/Employee)
http://technet.microsoft.com/en-us/library/cc288191(office.12).aspx
Backup/Restore
stsadm -o backup -url http://localhost/ -filename c:\helpdesk.bak
stsadm -o restore -url http://localhost/ -filename c:\helpdesk.bak -overwrite
http://technet.microsoft.com/en-us/library/cc263431(office.12).aspx
stsadm.exe -o export -url http://localhost/ -filename C:\Export.cab -includeusersecurity -versions 4 -overwrite
stsadm.exe -o import -url http://localhost/ -filename C:\Export.cab -includeusersecurity
Can export/import sub-sites with this method (i.e. http://portal/Communities/Employee)
http://technet.microsoft.com/en-us/library/cc288191(office.12).aspx
Backup/Restore
stsadm -o backup -url http://localhost/ -filename c:\helpdesk.bak
stsadm -o restore -url http://localhost/ -filename c:\helpdesk.bak -overwrite
http://technet.microsoft.com/en-us/library/cc263431(office.12).aspx
Labels:
SharePoint,
stsadm
Wednesday, January 18, 2012
PowerShell Commands To List SharePoint Features
List all installed features on the farmIt’s really straight forward using the Get-SPFeature command to return all installed features. To provide a little more readability to the output it can be sorted as follows:
By feature display name alphabetically,
By feature ID,
By feature display name alphabetically and grouped by scope,
And to write this to a file to allow for viewing in Notepad, Excel etc,
List all activated site scoped featuresEspecially in the case of hidden features it’s sometimes necessary to track down if a feature is active on a site collection. Here’s a quick way of seeing which features are activated for an SPSite:
List all activated web scoped featuresAnd only slightly modified from the Get-Help Get-SPFeature -examples text, here is a command to list all web activated featres for a site collection:
From this site: Link to Site
By feature display name alphabetically,
Get-SPFeature | Sort -Property DisplayName
By feature ID,
Get-SPFeature | Sort -Property Id
By feature display name alphabetically and grouped by scope,
Get-SPFeature | Sort -Property Scope,DisplayName | FT -GroupBy Scope DisplayName,Id
And to write this to a file to allow for viewing in Notepad, Excel etc,
Get-SPFeature | Sort -Property Scope,DisplayName | FT -GroupBy Scope DisplayName,Id > c:\AllInstalledFeatures.txt
List all activated site scoped featuresEspecially in the case of hidden features it’s sometimes necessary to track down if a feature is active on a site collection. Here’s a quick way of seeing which features are activated for an SPSite:
Get-SPFeature -Site http://sitecollectionurl | Sort DisplayName | FT DisplayName,Id
List all activated web scoped featuresAnd only slightly modified from the Get-Help Get-SPFeature -examples text, here is a command to list all web activated featres for a site collection:
Get-SPSite http://sitecollectionurl | Get-SPWeb -Limit ALL | %{ Get-SPFeature -Web $_ } | Sort DisplayName -Unique | FT DisplayName,IdFrom this site: Link to Site
Labels:
PowerShell,
SharePoint
Thursday, January 12, 2012
Uninstall ReportServer Feature in SP 2010
After upgrading to SharePoint 2010 I have these Site Content Types now in my site collection. To get rid of them you have to uninstall the Report Server feature and re-install.
To do this in PowerShell:
Uninstall-SPFeature ReportServer -force
Install-SPFeature ReportServer
Go into Site Collection Features and activate Report Server Integration feature (and then deactivate if you don't need it).
To do this in PowerShell:
Uninstall-SPFeature ReportServer -force
Install-SPFeature ReportServer
Go into Site Collection Features and activate Report Server Integration feature (and then deactivate if you don't need it).
Labels:
PowerShell,
SharePoint
Tuesday, January 10, 2012
Nintex URLs
Custom Start Page:
_layouts/NintexWorkflow/PHMIC_Custom/CustomStartWorkflow.aspx
Locate all Nintex flows in Site:
/NintexWorkflows/Forms/AllItems.aspx
_layouts/NintexWorkflow/PHMIC_Custom/CustomStartWorkflow.aspx
Locate all Nintex flows in Site:
/NintexWorkflows/Forms/AllItems.aspx
Labels:
Nintex,
SharePoint
Subscribe to:
Comments (Atom)
