Skip to content

Instantly share code, notes, and snippets.

View devendrasv's full-sized avatar

Devendra Velegandla devendrasv

View GitHub Profile
@devendrasv
devendrasv / Getlistofdoclib.ps1
Last active December 24, 2015 17:29
Get all document libraries in a site collection
#Load powershell snapin
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#Get site collection details
$s = Get-SPSite http://spjourney
#Get all web sites in the site collections
$wc = $s.AllWebs
foreach($w in $wc)
{
#loopthrouh the lists and libraries in the site
foreach($l in $w.Lists)
@devendrasv
devendrasv / GetlistofDocumentlibraries.ps1
Last active December 24, 2015 17:29
Get list of Document libraries where content approval for submitted items is yes
#Load powershell snapin
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#Get site collection details
$s = Get-SPSite http://spjourney
#Get all web sites in the site collections
$wc = $s.AllWebs
foreach($w in $wc)
{
#loopthrouh the lists and libraries in the site
foreach($l in $w.Lists)
@devendrasv
devendrasv / gist:6621159
Last active December 23, 2015 10:19
Get Team Site collections and sub sites last modified date and size in a web application
#constructing table
$a = "<style>"
$a = $a + "BODY{background-color:#ffffff;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: ;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:wheat}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}"
$a = $a + "</style>"
#Getting the list of site collection from the webapplication and stroing in an array
[array]$sites= get-spwebapplication http://sharepoint-journey.com| get-spsite -Limit All
@devendrasv
devendrasv / gist:6621125
Last active December 23, 2015 10:19
Get Site collection and sub site last modified date and size in a web application
#constructing table
$a = "<style>"
$a = $a + "BODY{background-color:#ffffff;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: ;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:wheat}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}"
$a = $a + "</style>"
#Getting the list of site collection from the webapplication and stroing in an array
[array]$sites= get-spwebapplication http://sharepoint-journey.com| get-spsite -Limit All
@devendrasv
devendrasv / gist:5d6feca4d54c9ac1ee8a
Last active December 23, 2015 06:19
Export wsps in sharepoint farm
(Get-SPFarm).Solutions | ForEach-Object{$var= "C:\WSP" + "\" + $_.Name; $_.SolutionFile.SaveAs($var)}
@devendrasv
devendrasv / Activate-Publishing-Feature-using-Stsadm
Last active December 20, 2015 03:19
Activate Publishing Feature using Stsadm
stsadm -o activatefeature -filename publishingSite\feature.xml -url -force "http://sharepoint-journey.com/sites/appdevelopment"
@devendrasv
devendrasv / publishing activate feature.ps1
Last active December 20, 2015 03:19
Activate publishing activate feature
$siteUrl = "http://sharepoint-journey.com/sites/appdevelopment"
$siteCollection = Get-SPSite $siteUrl
Enable-SPFeature "PublishingSite" -Url $siteCollection.Url -force
<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="Incident Details" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/ListDefinition-Incident ListDefinition" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>
<ContentTypeRef ID="0x01000bc0b06140de4019aa00b227a8d5a35c"/>
<ContentTypeRef ID="0x01">
<Folder TargetName="Item" />
</ContentTypeRef>
<ContentTypeRef ID="0x0120" />
</ContentTypes>
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List Definition project item, an error will occur when the project is run. -->
<ListTemplate
Name="Incident ListDefinition"
Type="20000"
BaseType="0"
OnQuickLaunch="TRUE"
SecurityBits="11"
Sequence="410"
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="Incident Info"
OnQuickLaunch="TRUE"
TemplateType="20000"
Url="Lists/Incident Info"
Description="My List Instance">
</ListInstance>
</Elements>