Archive for January, 2015

SharePoint 2007/2010: Get All Sites, Lists Names, List Paths, Items Count, Versions, and Last Items Modified Using PowerShell

January 30, 2015 Leave a comment

If you need to get a list of all Sites, Lists Names, Paths, Item Count, Versions, and Last Modified for a specific Site within your SharePoint 2010 enviornment you can utilize the following powershell script to generate a .txt file that will provide you with that needed information.

I created this script for MOSS 2007, but it can also be utilized in your SP2010 environment.

[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bc111e9429c”)
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bc111e9429c”)

$SPSite = New-Object Microsoft.SharePoint.SPSite(https://portal)
$total_lists = 0
$many_vers = 0

$SPSite.AllWebs | ForEach-Object {
$weburl = $_.ServerRelativeUrl
$_.Lists | ForEach-Object {

if ($_.Hidden -eq $false) {

write-output “Site – $($_.ParentWebUrl), List Name – $($_.Title), Path – $($_.ParentWebUrl)/$($_.RootFolder), Item Count – $($_.Items.Count), Last Modified – $($_.LastItemModifiedDate)” >> all_lists.txt
$total_lists += 1

$_.Items | ForEach-Object {
if ($_.Versions.Count -ge 10) {
write-output “$($_.Versions.Count)’t$(weburl)/$($_.url)” >> many_vers.txt



SharePoint 2010: Output Search Query Results Using PowerShell into .csv file

January 21, 2015 Leave a comment

I recently had to perform a massive search query for specific terms (key words) in my SharePoint 2010 environment, and provide a .csv file for all returned results.  The easiest way for me to do this was by utilizing the power of PowerShell.  So instead of having to manually execute separate Search queries within SharePoint Search I executed this script, which outputs the search results in an easy to read formatted .csv file.

#Setup a keyword query object
$site = New-Object Microsoft.SharePoint.SPSite http://portal
$kq = New-Object Microsoft.Office.Server.Query.KeywordQuery $site

#Set some query properties
$kq.ResultTypes = [Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults
$kq.RowlLimit = 10000

#issue the query
$resultTableCollection = $kq.Exectute()

#Get the result Table
$relResultTable = $resultTableCollection.Item([Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults)
$relDataTable = $relResultTable

#Output the results to .csv file
$relDataTable.Rows | select-object Path, Title, Description, Write, HitHighligedSummary | Export-Csv “c:\temp\searchresults.csv” -NoTypeInformation

The .csv file will provide the Path, Title, Description, Date Modified, and Highlighted Summary of the search results.

Hope this helps others that might need to do a similar search against their SP environment.

SharePoint 2010 – Failed Export : String or binary data would be truncated

January 12, 2015 Leave a comment

When attempting to execute a PS Script to export a Site Collection in SharePoint 2010 (Export-SPWeb) I was receiving the following error in the export log:

Failed Export : String or binary data would be truncated

Having experienced this before I knew this had to do with lengthy URL’s that exceed the 260 length limit threshold within SharePoint.  Even though SharePoint does not warn you when the URLs exceed that threshold it will not allow you to export sites with URL’s longer than that 260 character limit.

To determine where in the Site Collection there might be URL’s longer than the 260 characters limit you can determine this in two different ways.

The supported way via PowerShell, or by taking a backup of your current production database and executing a query on the database to find the URLs and then making changes to those URLs within SharePoint.  I will only show you the supported way via PowerShell.

Utilizing PowerShell to generate a .csv report of SharePoint URLs  with character lengths greater than or equal to 260 characters.


#Get SPSite
$site = Get-SPSite http://portal

#Create .csv file to store URL Length results$URLLengths = “URL `t”  + “Length” >> URLLength.csv

#foreach loop to loop through all webs in a site
foreach ($web in $site.AllWebs)

#foreach loop to loop through all lists in the webs
foreach ($list in $web.Lists)
#foreach loop to loop through all items in a list
foreach ($item in $list.Items)
#Generate item level URL
$url = $web.URL + “/” + $item.URL
#Get URL Length
$urlLength = $url.Length

#If statement to check URL Length.  If greater than or equal to 260 write to .csv file
if ($urlLength -ge 260)

$url + “`t” + $urlLength >> $URLLengths


This script will generate a csv file with all the URL’s longer than 260 characters.   You will have to manually go to each URL and physically change the length of the URL before you can export.

Hopefully this helps others that might run into a similiar issue.




SharePoint 2010: Fix – The RSS WebPart does not support authenticated feeds.

January 9, 2015 1 comment

I recently ran into an issue when adding an RSS Feed WebPart into one of my SharePoint 2010 Sites when linking an internal SP list as the RSS feed.  When doing so I received the following error:

“The RSS WebPart does not support authenticated feeds”

Within SharePoint 2010 to get RSS WebParts to work successfully with internal RSS feeds you have to make sure your site is Kerberos enabled.  If not your RSS WebParts will not work.  External RSS feeds will work fine on none Kerberos enabled web applications.

In my case I had Kerberos enabled, SSL set, SPNs set, and had anonymous access disabled, since in my environment we leverage a PKI Token base authentication through TMG. Ideally this should work fine, but there was one last step that I needed to do to bypass the above error.

Within the web.config file of the (Kerberos) Web Application that will  host the RSS Feed WebPart I also had to update the AllowAnonymousImpersonation setting to FALSE on all the WFE’s.

1.  Open up web.config file for (Kerberos) Web Application
2.  Search for AllowAnonymousImpersonation
3.  Change the following element:

<add key=”aspnet:AllowAnonymousImpersonation” value=”true” />


<add key=”aspent:AllowAnonymousImpersonation” value=”false” />

4.  Save web.config file

Now when I browse the site with the RSS Feed WebPart the webpart should render the list feed with no problem.