Friday, May 1, 2015

Powershell to list all SharePoint Site Collections and subsites a web application

Get list of SharePoint Site Collections and SubSites

Get-SPSite 'http://sharepointwebapplicationurl/' | Get-SPWeb -Limit All

Powershell to list all SharePoint Site Collections in a web application

Get list of SharePoint Site Collections

Get-SPSite  -Limit All

Powershell to list all SharePoint databases and their sizes

Get list of SharePoint databases and their sizes

Get-SPDatabase | Sort-Object disksizerequired -desc | %{write-host  "Size: $($_.disksizerequired/1mb)MB - Database: $($_.Name)"}

The result will be listed down in the below format.

Size: 5237MB - Database: SharePoint_Config
Size: 3455MB - Database: UsageDB
Size: 2261MB - Database: SharePoint_AdminContent
Size: 204MB - Database: WebAnalyticsStagerDB
Size: 172MB - Database: Sync DB
Size: 155MB - Database: SearchDB_PropertyStore
.
.
.
.
.
Size: 6MB - Database: BusinessDataCatalogDB
Size: 3MB - Database: SecureStoreServiceAppDB
Size: 2MB - Database: StateServiceDB
Size: 2MB - Database: PerformancePointDB

Powershell to list all SharePoint Content Databases in the SharePoint Farm

Get list of all SharePoint Content Databases in the SharePoint Farm

Get-SPContentDatabase

Powershell to list all SharePoint Databases in the SharePoint Farm

Get list of SharePoint Databases in the SharePoint Farm

Get-SPDatabase

Wednesday, April 29, 2015

Unable to process the request . Wait a few minutes and try performing this operation again

Issue Description

Recently I came across this issue where some of the end users were getting an error message when they tried to open an Excel file in SharePoint in the browser.

Unable to process the request.
Wait a few minutes and try performing this operation again.

Unable to process the request 1

Cause

The Excel Services Application server computer is in a non-valid state and may need to be restarted.

Resolution

Most of the online articles were asking me to restart the Central Administration server.I did not want to do that and found a different fix.


Identify the application pool running the Excel Services service application (from IIS) and Recycle it.

1) Start –>Run –> inetmgr

2) Under the Sites click on SharePoint Web Services. This will list down the Services in SharePoint.

3) Click on each GUID –> Change the view from Features View to Content View

4) On finding ExcelService.asmx -> Right click that web service -> Manage Application -> Advanced Settings.

5) Identify the Application Pool (make a note of this).

6) Now in IIS –> Application Pools –> choose the Application Pool you noted down in previous step   -> Recycle (recycle the application pool).



Unable to process the request 2

Identify the Application Pool for a Service Application

1) Start –>Run –> inetmgr

2) Under the Sites click on SharePoint Web Services. This will list down the Services in SharePoint.

3) Click on each GUID –> Change the view from Features View to Content View

4) On finding SearchService.svc -> Right click that web service -> Manage Application -> Advanced Settings.

5) Identify the Application Pool (make a note of this).


6) Now in IIS –> Application Pools –> choose the Application Pool you noted down in previous step   -> Recycle (recycle the application pool).



Tuesday, April 28, 2015

Internal server error exception: System.NullReferenceException: Object reference not set to an instance of an object

Error Description

Recently I came across this error with SharePoint Search. I was searching in a SharePoint list and got the below error.
Error
Internal server error exception:
Troubleshoot issues with Microsoft SharePoint Foundation.

On checking the ULS logs I found the below entries

01/28/2015 10:59:51.10         w3wp.exe (0x31D8)                0x2030    SharePoint Server Search      Query      fm9a        Unexpected                CoreResultsWebPart::OnInit: Exception initializing: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.SetPropertiesOnQueryReader()     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.OnInit(EventArgs e)               7001a8bf-b506-4096-b46b-003fbb5ec91b

01/28/2015 10:59:51.10         w3wp.exe (0x31D8)                0x2030    SharePoint Server Search      Query      g1j9         Exception                Internal server error exception: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.SetPropertiesOnQueryReader()     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.OnInit(EventArgs e) System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.SetPropertiesOnQueryReader()     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.OnInit(EventArgs e)               7001a8bf-b506-4096-b46b-003fbb5ec91b


01/28/2015 10:59:51.10         w3wp.exe (0x31D8)                0x2030    SharePoint Server  Unified Logging Service       c91s        Monitorable                Watson bucket parameters: SharePoint Server 2010, ULSException14, 06175311 "sharepoint server search", 0e001b67 "14.0.7015.0", 17853a8f "microsoft.office.server.search", 0e001bd1 "14.0.7121.0", 531f1826 "tue mar 11 10:05:26 2014", 000032a4 "000032a4", 0000002d "0000002d", 4a6d3421 "nullreferenceexception", 67316a39 "g1j9"    7001a8bf-b506-4096-b46b-003fbb5ec91b


Solution 1

If you go into Central Administration -> System Settings -> Manage Services on Server. Make sure the below services are started.

- SharePoint Server Search
- Search Query and Site Settings Service

Solution 2

Click through all the Search Administration pages in Central Admin.Click through all the Search Administration pages in Central Admin. Now perform the search again. The issue should have disappeared.


Solution 3

Identify the underlying application pool for search (Reference)
Perform an application pool recycle

Wednesday, April 15, 2015

SharePoint Crawled Properties and Managed Properties

Last year, when I had an interview, I was asked the difference between crawled property and managed property. Though I have come across this multiple times and even after working on Search Project, I could not give a satisfactory answer.(honestly ,even for me the answer was not satisfactory)

So what is Crawled Property and Managed Property in SharePoint ???

Crawled Properties and Managed Properties are very basic SharePoint concepts but they are building elements of SharePoint Search. Below is an example which might help you understand this in a better way.
SharePoint crawls data from different sources. The data in these various source systems have metadata which can have different names but it refers to the same information.

As an example different systems can store the information about the Author in various systems with the name as :

Author
Created By
Writer
Owner
and in case of emails it is stored in field From.

But all these fields represent the same information which represent who has created this.

Now when SharePoint crawl these various systems , all these properties become Crawled Properties.
In SharePoint we can group all these Crawled Properties under one Managed Properties.
The below image is a pictorial representation of what I said above.


















Note

One crawled property can be part of multiple Managed Properties.
Managed property can be used in scopes, refiners..etc.

Tuesday, April 14, 2015

Cascading Drop-Down List in a SharePoint 2010 List

Cascading Drop-Down List in a SharePoint 2010 List
This post explains how to implement a Cascading Drop-Down List in a SharePoint 2010 List using jQuery and SPServices. To implement a Cascading Drop-Down List in a SharePoint 2010 List using jQuery and SPServices follow the below steps.

Steps

1. Create a Country custom list


Country List



2. Create a State Custom list with a Country lookup column.


Look up Column Settings


State List



3. Download the following jquery files and upload in your Sharepoint site in site Assets library in a folder named JSLibrary(Create the folder if is not present).

jquery-1.4.2.min.js
jquery.SPServices-0.5.7.min.js



4. Create a CascadeDropDownList with Country and State lookup columns.




5. Select the Default New Form under the List tab of the newly created List CascadeDropDownList.



6. Add a HTML Form Web Part and select Edit HTML Source under the Format Text Tab.



7. Copy and Paste the following code in the HTML Editor:

<script language="javascript" src="/SiteAssets/JSLibrary/jquery-1.4.2.min.js" type="text/javascript"> 
</script> <script language="javascript" src="/SiteAssets/JSLibrary/jquery.SPServices-0.5.7.min.js" type="text/javascript"></script> 
<script type="text/javascript"> 
  $(document).ready(function() { 
            $().SPServices.SPCascadeDropdowns({ 
                relationshipList: "State", 
                relationshipListParentColumn: "Country", 
                relationshipListChildColumn: "Title", 
                relationshipListSortColumn: "ID", 
                parentColumn: "Country", 
                childColumn: "State", 
                promptText: "Choose State...", 
                debug: true 
            }); 
}); 
</script>