Change or rename the subsite URL


I can’t rename a URL of a site (using the Site Settings>Title,Description and Icon) I received an error “The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator”

None of the lists in the subsite exceeds the list view threshold item limits.  But when the same operation is attempted with farm admin account is succeeded as that account default is 20000 anyway. So it seems the total items in that site is adding up for this action and not allowing the rename of url.

Two options :

  • Find and increase the LVT.
  • Alternatively use ‘farm account’ to rename on site or use powershell to update (Get-SPWeb http://portal/subsite | Set-SPWeb -RelativeUrl newsubsitename)  in either case the underlying account uses List View Threshold for auditors and administrators which has higher limits of LVT so it could succeed.

Find All InfoPath Form Libraries and lists in SharePoint


As part of the cleanup activity one of the SharePoint analyst requested a report listing all the forms libraries and lists as well with document count and last modified date. Finding lists with forms enabled was different used SharePoint manager to search and query for the property which separates lists with and without forms but no luck.

Then I found the following property from one of the blog and married up the script with Rajack’s script to produce a script works for me.

 

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
 
#Get the web application
Write-Host "Enter the Web Application URL:"
$WebAppURL= Read-Host
$SiteColletion = Get-SPSite($WebAppURL)
$WebApp = $SiteColletion.WebApplication
 
#Write the CSV header
"Site Collection `t Site `t List Name `t List Url `t Docs Count `t Last Modified `t Form Template" > InfoPathLibs.csv
 
#Loop through all site collections of the web app
    foreach ($site in $WebApp.Sites)
    {
       # get the collection of webs
       foreach($web in $site.AllWebs)
        {
            write-host "Scaning Site" $web.title "@" $web.URL
               foreach($list in $web.lists)
               {
                   if( $list.BaseType -eq "DocumentLibrary" -and $list.BaseTemplate -eq "XMLForm")
                    {
                    $listModDate = $list.LastItemModifiedDate.ToShortDateString()
                    $listTemplate = $list.ServerRelativeDocumentTemplateUrl
                    
       #Write data to CSV File
                   $site.RootWeb.Title +"`t" + $web.Title +"`t" + $list.title +"`t" + $Web.Url + "/" + $List.RootFolder.Url  +"`t" + $list.ItemCount +"`t" + $listModDate +"`t"  + $listTemplate >> InfoPathLibs.csv
                }
                elseif ($list.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"])
                {
                    $listModDate = $list.LastItemModifiedDate.ToShortDateString()
                    $listTemplate = $list.ServerRelativeDocumentTemplateUrl
                    #Write data to CSV File
                   $site.RootWeb.Title +"`t" + $web.Title +"`t" + $list.title +"`t" + $Web.Url + "/" + $List.RootFolder.Url  +"`t" + $list.ItemCount +"`t" + $listModDate +"`t"  + $listTemplate >> InfoPathLibs.csv
                }
             
               }
        }
    }
 
#Dispose of the site object
$siteColletion.Dispose()
Write-host  "Report Generated at same path of the powershell script InfoPathLibs.csv" -foregroundcolor green

The following report looks like:

In the below report which ever list does not have a form template implies its a list and all others are document libraries.

report

 

PowerShell Script – list all SharePoint group members


A quick script to query  site collections in a web application for SharePoint group and list all the members of that group and export into an CSV file. In the below example I am looking for “Power Users” group and list all the members of that group

$sites = Get-SPWebApplication http://intranet.contoso.com | Get-SPSite -limit all
"Site Collection`t Group`t User Name`t User Login" | out-file groupmembersreport.csv
foreach($site in $sites)
{
	$sitegroup = $site.RootWeb.SiteGroups |?{$_.Name -EQ "Power Users"}
	foreach($user in $sitegroup.Users)
		{	
		"$($site.url) `t $($sitegroup.Name) `t $($user.displayname) `t $($user) " | out-file groupmembersreport.csv -append
		}
$site.Dispose()
}

If you are interested in querying all the groups in the site collections and list all the members

# if you want to query all the site collections and its groups members then un comment line 4 and comment line 5
# $sites = get-spsite -limit All
$sites = Get-SPWebApplication http://intranet.contoso.com | Get-SPSite -limit all
"Site Collection`t Group`t User Name`t User Login" | out-file groupmembersreport.csv
foreach($site in $sites)
{
	foreach($sitegroup in $site.RootWeb.SiteGroups)
        {
	  foreach($user in $sitegroup.Users)
	 	{	
		"$($site.url) `t $($sitegroup.Name) `t $($user.displayname) `t $($user) " | out-file groupmembersreport.csv -append
		}
          }
$site.Dispose()
}

You can also write in a single line if you quickly want to query for a single site collection

Get-Spweb http://intranet.contoso.com | Select -ExpandProperty SiteGroups | Where {$_.Name -EQ "Power Users"} | Select -ExpandProperty Users | Select Name, userlogin, Email

 

Cleanup user information list and remove users from Site


Recently one of the analyst requested can we cleanup profiles in the User Information List in a site collection as he was looking to create a template out of it. This is an interesting topic because not only this is important for as a template but it is also an extranet site (internet facing) and its a good practice to minimize the user information exposed externally, most of the extranet site collections if not taken care the details can be queried by directly pointing the site collections to the following url’s

http://<site_collection_url>/_layouts/userdisp.aspx?Force=True&ID=20  (change the number to query groups and users and their personal details)

Coming back to the point how to delete user profiles in a site collection, and also cleanup the user information list, check the below powershell.

Note: It also deletes the users and user permission on the site collection.

$sc = Read-host "Enter Site Collection URL"
$site = get-spsite $sc
$users = get-spuser -web $site.rootweb -limit All
foreach ($user in $users){remove-spuser -identity $user.userlogin -web $site.rootweb -confirm:$false -erroraction Silentlycontinue }

Another approach to filter and cleanup the user information list below. This remove the groups as well if not filtered by the item.ID while passing the item to remove.

# Note: take a backup of your site collection before attempting this script - 
# Note: this script could strip all the users and their permissions on the site
$sc = Read-host "Enter Site Collection URL"
$web = get-spweb $sc
$list = $web.SiteUserInfoList
#this will get all the users and groups so be careful while passing $item to remove.
$items = $list.getitems()

foreach ($item in $items){$web.siteusers.RemoveByID($item.ID) -erroraction Silentlycontinue }

This is a simple post to achieve what I am looking and there is a potential to corrupt your site collections, I had taken care to test in my DEV farm. This has been tested in sharepoint 2010 sp1 only.

The below posts can help you further on this topic.

http://www.sharepointdiary.com/2012/04/delete-users-clean-up-user-information-list.html

http://blog.falchionconsulting.com/index.php/tag/set-spuser/

 

“Alert Me” Missing in the SharePoint Ribbon


These is a strange issue that “Alert Me” button Missing in the SharePoint Ribbon but only for a few site collections and for one complete web application. Check the following paths in central administration.

alertme-missing

  • Central Admin –> Systems settings –>E-Mail and Text messages –> Configure outgoing email settingsoutgoingemailsettingsfarm-outgoingemail
  • Also make sure the web application outgoing email settings are filled as well.

webapplication-outgoingemail

But in this case some web applications are showing “Alert Me” button and this I vaguely remembered something with STSADM commands, and this was suggested by me to the customer to disable alerts for any restored databases from prod to test to stop the site collection from sending alerts to users.

There is a STSADM property which is by default enabled and we can turn the property to false for each site collection or to a complete web application.

#To disable alerts, use the following syntax:
stsadm -o setproperty -url http://server_name -pn alerts-enabled -pv false

#To view the setting for the alerts-enabled property, use the following syntax:

stsadm -o getproperty -url http://server_name -pn alerts-enabled
PS C:> stsadm -o getproperty -url http://teams.contoso.com -pn alerts-enabled

<Property Exist="Yes" Value="no" />

PS C:> stsadm -o setproperty -url http://teams.contoso.com -pn alerts-enabled -pv true

Operation completed successfully.

The following documentation will be helpful to start on this: Here

At the time of this writing these details applies to SharePoint 2010.

 

tags: SharePoint 2010, powershell, SharePoint Alerts, STSADM

Sharepoint – WorkFlow Timer Job Paused


On a random daily check on CA we found workflow timer job in “Paused” state in Central Admin. Multiple of these pointing to each server in farm in paused state. Many blog posts pointing to restarting the timer service on each server and also clearing the timer cache (configuration cache) would resolve the issue.

http://www.sharepointsiren.com/2013/05/sharepoint-timer-job-stuckpaused-fix.html

http://markimarta.com/sharepoint/paused-workflows-in-sharepoint-timer-job-fix/

After the cache is cleared initially the jobs ran for a couple of instances and they were again pausing and the reason was a modified workflow resulting in a “dead end” state. Which was a mistake by the user. Each server processing workflows timer job became “stuck” due to items reaching the “dead end” state. All workflows with pauses or state changes would have ceased to be processed at this stage.

Under normal operations, a workflow is first executed in the World Wide Web Publishing Service (w3wp.exe). After a delay or pause, in which the workflow “sleeps,” it wakes up and is then run by the SharePoint Timer Service (the owstimer.exe process).

 When w3wp.exe is under excessive load, it postpones the workflow. The Timer Service is then used to the continue the process. SharePoint dictates which Workflow Timer service will run the workflow; the operation can occur on any server running the “Microsoft SharePoint Foundation Workflow Timer Service” service. However, when Nintex Workflow is installed, it only deploys the DLLs required to run workflows to WFE servers–specifically, those servers running the “Microsoft SharePoint Foundation Web Application” service.

This issue is discovered by enabling verbose logging both at CA and also at Nintex global settings and also querying for the workflow name and its site collections using Nintex NWAdmin.exe

After the workflow is modified and already the workflows which are started with the broken workflow is cleared and again restarting the timer services on servers with clearing the cache resolved the issue.

This issue is reported on SharePoint 2010 and Nintex 2010

 

 

Tags: nintex workflow, State changes error, workflow timer job paused, sharepoint timer service restart.

SharePoint Calculated Column – how to work around


Q: I work in Communications and we collect the news related to our department and send it out by email twice daily, once in the morning and once in the afternoon. I have set up a SharePoint library to group by Date, so it groups uploaded files by the date they were added, which is great. I was wondering if I could group the files under these dates by morning and afternoon (ie. before 12:00 and after 12:00) so by the time that they were added, so that they correspond with our morning and afternoon news alerts? Continue reading

The excel workbook shows error


The excel workbook shows error on my clients intranet homepage which is a excel web access webpart. Which checking the backend file and opening it with excel services has same error but when opened in excel it open fine.

Error: ” An Error has occurred. Please try again.

Investigations: The previous night there has been a power outage to the data center and next morning this is not working.

When the same file is renamed and saved again it works fine with excel web app so it could be something related to cache on the sever.

Then the eventlog on one of the frontend shows this error in application

5226

 Error: Unable to create or access workbook cache at C:WINDOWSTEMPExcel ServerFileCacheSharedServices1-1078443246Ranges. Excel Services is unable to function without a workbook cache

excelwebparterror

Bang on !!! when verified the “ranges” folder is missing on one of the WFE and the same excel url is tested on other WFE’s  which also displays error. I suppose the cache for each excel file using excel service is stored only on one server irrespective of which WFE this file is served.

Restore the folders in the path of the cache resolved the issue:

C:WINDOWSTEMPExcel ServerFileCacheSharedServices1-1078443246

This path has the following folders “Images”, “Ranges”, “SavedWorkbooks”, “Workbooks”

In case if that is also not working for you, you could remove the whole directory “Excel Server” in windowstemp folder and make sure the excel service application pool account has access to recreated folder at that path and restart the IIS should create the folder back again and rebuilt the cache as necessary.

More Detailed description and resoulution at: http://technet.microsoft.com/en-us/library/ee513091(v=office.14).aspx

Removing a Corrupted Site Column in SharePoint 2010


Errors like correlation Id:

System.ArgumentException: Invalid field name: {GUID} [URL of list]  (ULS log)

 “Field type xxx is not installed properly. Go to the list settings page to delete this field.”

To determine what field is causing the error run this PowerShell script.  The PowerShell should terminate with an error, along with the name of the erroneous field.

$web = Get-SPWeb http://portal/site

$fields = $web.Fields

foreach ($field in $fields} {write-host $field.id}

First you will need to determine the GUID ID for the corrupted column.  To do this you will run a PS script against the Site Collection to generate a report that lists all the fields, like so.

$web = Get-SPWeb http://portal/site

$web.AvailableFields.SchemaXml | Out-File c:tempfields.txt

Once done open up the fields.txt file and do a search for the corrupted column.

After determining the field name for the {GUID} I was then able to identify the problem column or content type. In my case the issue was with a column name “TypeTaxHTField0″ or simply Type. SharePoint by default appends the TaxHTField0 suffix to the end of all the static names.

Now that I have the Field Name Column, I needed a way to get into the lists settings to either delete or remove this column from the list. Since I was unable to access the list because of the correlation id, I had to determine the {GUID} of the list.

The way to get the {GUID} of the list I turned to PowerShell.

Below is the script I used to get the {GUID} of the list.

$site = Get-SPSite {URL OF YOUR SITE}

$web = $site.OpenWeb(“SUBSITE”)

$web.lists | Format-Table title,id

$web.Dispose()

$site.Dispose()

Once I got the {GUID} of the list I was then able to browse to the library settings by appending the {GUID} to the end of the list settings edit URL

i.e.

http://URL OF SITE/SUBSITE/_layouts/listedit.aspx?List={GUID}

Once inside the list settings I was then able to make the necessary changes. For me all I needed to do was remove the “Type” column from the Metadata Navigation Settings by removing it from both “Configure Navigation Hierarchies” and “Configure Key Filters”

Once I removed the “Type” column from the Metadata Navigation I then deleted the “Type” column from my list and then re-added it. Once I re-added it back into the list, I then re-added it back into the Metadata Navigation. Ater doing so I was able to access the list without error. If you find you do not need that column at all, simply delete it from your list.

Another way to get the field name from “SharePoint Manager” (a tool can be found in codeplex.com ) Run this tool on a SP server and navigate to subsite and fields to get more richer information using object model. http://spm.codeplex.com/

Hopefully this helps others who encounter the same issues.

list view filters displaying few records


If you have a list with more than 5000 items and if the item threshold limit is 5000, even after using filter you may see it displays:

“This view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administrator.”

“Displaying only the newest results below. To view all results, narrow your query by adding a filter.”

For a view to quickly filter through a large number of items, the first column that you specify in the filter must be indexed. Other columns you specify in the view filter may or may not be indexed, but the view does not use those indexes. You also need to make sure that the first column of the filter does not return more items than the List View Threshold, even if the final result of the filtered view returns less than the List View Threshold.

If the first column of the filter returns more items than the List View Threshold, you can use a filter with two or more columns. When you define a filtered view that uses two or more columns, using an AND operator will usually limit the total number of items returned. But even in this case, you still need to specify as the first column in the filter the column that most likely returns the lesser amount of data. Note that using an OR filter almost always increases the number of items returned and won’t be effective under these circumstances.

So sometimes if easy to switch the filters like if you would like to filter location and them by date range try switching the filters use date range first so that the filter results are less than threshold value and then use your other filters.

As we spoke how to create a index on a column:

1.Navigate to the site that contains the list or library.
2.Click its name on the Quick Launch, or click on the Settings menu , click View All Site Content, and then click the name.
3.Click List or Library > List Settings or Library Settings.
4.Under the Columns section, click Indexed columns.
5.On the Indexed Columns page, click Create a new index.
6.Do one of the following: To create a simple index:
1.In the Primary Column section, under Primary column for this index, select the column.
2.Click Create. To create a compound index:
3.In the Primary Column section, under Primary column for this index, select the column.
4.In the Secondary Column section, under Secondary column for this index, select a different column.
5.Click Create.