Friday, February 28, 2014

Metadata navigation makes it easier to find and dynamically filter
content in large lists and libraries. Once enabled, it uses a
navigation tree in the quick launch. Solution:
You must activate "Metadata Navigation and Filtering" Feature from Site features page! To enable Metadata Navigation and Filtering, Login as a Site Owner or Site Collection Administrator to your SharePoint site.

Click on Site Settings Icon >> Under Site Actions, click on Manage site features.

In the Features Page, click Activate button next to Metadata Navigation and Filtering.

Now, You can configure metadata navigation to your SharePoint list and libraries.

Tuesday, February 25, 2014

Requirement: We've created a custom search scope "Search All Documents" in SharePoint Central Admin and would like to include it in search scope drop downs of few site collections.

SharePoint 2010 add search scope to drop down:
Well, its a few-clicks job to include custom search scopes to search drop down in SharePoint. Here is how:

Go to Site Actions >> Site Settings

Click on "Search Scopes" link under Site collection administration

Click on "Display Groups" link and choose "Search Dropdown"

From here, we can include/exclude any scopes to search dropdown by simply selecting/deselecting check-boxes.

Add custom scope to SharePoint Search Scope Drop downs using PowerShell
While its not tedious to customize search scope dropdowns by following above steps for few site, We had to do it for all site collections under a particular managed path.(around 50!). Here is the PowerShell script to add custom search scopes to SharePoint search dropdown:

Please note: There could be many OOTB features stay Inactive based on the site template we use. So, Use this script to get an insight of your custom features deployed to the SharePoint 2013/SharePoint 2010 environments.

Task: Generate a report for All Installed/Activated Features for the entire SharePoint Environment. Here are some nifty PowerShell scripts to find features installed on the farm as well as specific features activated on a particular scope.

Get-SPFeature cmdlet:
Get-SPFeature cmdlet retrieves all features installed on the environment, when "Scope" parameter's value is not
supplied. It gets all activated features on the particular scope, when you provide scope
parameter: (Such as : -site "http://sharepointsite.com")

Get a list of all installed SharePoint features, Grouped by feature scope:

Sunday, February 23, 2014

Requirement: PowerShell to Import XML to SharePoint List
We've an utility from third-party system that generates project data in XML format. We had to import those data to a list in the PMO site. In other words: We've to import from XML file to SharePoint list.

Thursday, February 20, 2014

Requirement:
By default, SharePoint search engine craws and indexes all documents and its associated metadata properties from lists and libraries. In our case, We keep few fields for configuration in a custom SharePoint application and don't want those fields to appear in SharePoint Search results.

This is applicable only to site columns in SharePoint!

How to Exclude a column from SharePoint Search?
Here is how you can remove columns from SharePoint search.

Navigate to the site settings page by clicking settings gear

On the Site Settings page, click on "Searchable Columns" link under search group.

Select the check box next to the column(s) that you want to suppress from search.

Click OK to save your changes.

This ensures the particular metadata column isn't picked up by the search engine in SharePoint and excludes the site column data within the current site.

PowerShell Script to Exclude Field from Search:
SharePoint Fields/Columns has a property: NoCrawl, just turn it ON, we can exclude columns from SharePoint Search! Here is how I turned Off search visibility of a field using PowerShell:

Requirement:
During a branding project, We had to deploy a logo file every time to all SharePoint servers by individually logging in to them and copy pasting given file to all SharePoint 2013 server's 15 hive. Wanted to do a bit automation with PowerShell here. Let the PowerShell do Copy-Paste for us.

Every wondered how to find the user who has created/modified a particular SharePoint view? and when it was created/modified? Well, There is no SharePoint UI to get these information! But using SharePoint object model, we can retrieve these data programmatically from SPFile object's properties.

Tuesday, February 18, 2014

Requirement is to find out owners of each SharePoint site collection in the environment.We needed this data to get approvals on critical changes and to inform site owners prior to maintenance windows.

Simple! Use STSADM command:
On SharePoint 2007 and above, STSADM command can be used to get primary owner details of site collections:Syntax:stsadm -0 enumsites -url <web-app-url> E.g.stsadm -0 enumsites -url "http://sharePoint.crescent.com" > SitesRpt.xml

This command enumerates all site collections and pulls site owner information. It also retrieves secondary owner, content database in which site collection exist and storage details of the site collection. Just open the generated XML file with Microsoft Excel.

Find Site Owners for All site collections using PowerShell:

Get-SPSite -Limit 'All' | select URL, Owner, SecondaryContact

For SharePoint 2007 Sites, The PowerShell script to get site Owners for all Site collections would be:

Wednesday, February 12, 2014

We usually use C# console application or feature activation code to register event receivers with the target list or library in SharePoint. At times, we may have to handle event receiver associations explicitly. Of course, there are some great tools in codeplex (E.g. http://speventreceiverman.codeplex.com/) to manage event receivers. However, in a production environment, which didn't allow me to use any such tools for security reasons, I'm left with the option: PowerShell. Hence, I'm sharing my PowerShell code snippets to manage event receivers in SharePoint using PowerShell.

Get all event receivers attached with a List:
Lets find in SharePoint 2010 PowerShell to get event receivers associated with a particular list.

Lets find all Event receivers on all sites in a web application:
Similarly, We can retrieve all event receivers associated with various lists and libraries across all site collection using the below PowerShell script.

SharePoint PowerShell to Add Event Receiver to List
Usually, we create a C#.net console application to associate a event receiver to a particular list. This time, I tried with PowerShell script: Lets deploy event receiver in SharePoint 2013 using PowerShell

Under "General" tab, Your domain name and NetBIOS names will be listed. Your domain’s NetBIOS name is the domain name (pre-Windows 2000).

What's the problem if its not enabled? Inconsistency in SAMAccountName field which could lead to many other issues such as: Some features may not work due to this inconsistency (Instead of "YourCompanyName\User" it could be "YourComp\user") , UPS Field mappings such as "Manager" field may go wrong, etc.

Enable NetBIOS Name for User Profile Service Application:
So, You find your NetBIOS name is different from Domain name and want to enable NetBIOS name for your user profile service application, isn't it? Well, Here is the PowerShell script:

Monday, February 3, 2014

"Getting Started" tiles are new addition to SharePoint 2013 team sites. These tiles intend to provide shortcuts to common actions, such as sharing your site, applying a theme. In SharePoint 2013, They replaces the “Getting Started” links from its previous version: SharePoint 2010.

Disable Getting Started Web Part:
From the home page you can remove this web part by simply clicking on "REMOVE THIS" link as shown in the above image. But it remains in the gallery in the event you would like to have it added back to the site. Just edit the page >> Insert >> Web Part >> Choose "Getting Started with your site" under "Media and Content" group, to add it back to your home page.

You can also find "Getting Started" link which is pointing to "GettingStarted.aspx" page under site action menu in SharePoint 2013.

This feature is automatically activated with the team site in SharePoint 2013. You can disable Getting Started menu item by going to Site Actions >> Site Settings >> Manage Site Features >> Deactivate "Getting Started" feature.

Disabling this feature removes the "Getting Started" link from site actions menu in SharePoint
2013, but doesn't remove "Get Started with Your Site" from home page. If you try to activate this feature again, it adds "Getting Started" web part to GettingStarted.aspx page one more time. So, activating and deactivating this feature just makes the page clumsy. Probably we can call it as a BUG? You can edit the page and remove unwanted web parts from it, If you would like to.

SharePoint doesn't provide a direct way to create alerts for groups. Alerts are always targeted to individual user accounts in SharePoint. If you have a requirement to create alerts for a group of people, create a E-mail enabled AD security group and add alert to it from SharePoint.

Set alert to group in SharePoint using PowerShell:
Alternatively, You can use PowerShell to create a SharePoint alert for a group.

Sunday, February 2, 2014

In SharePoint 2007, You can't save a list or site template (.stp ) file which is bigger than 10MB. MOSS 2007 gives an error message: "The list is too large to save as a template. The size of a template cannot exceed 10485760 bytes." When you try to save a list or site which by including its content which is more than 10 MB.

Fix is simple:
Just execute this stsadm command line from your SharePoint WFE server. Say, you want to allow site or list template up to 250 MB:

The above STSADM sets the property at farm level. Here the command line takes property value in bytes. Technically SharePoint compresses all content and saves with .stp extension, which can be simply renamed to .cab and extracted.

If you have a document library or list or site with content more
than 50MB and when you try to save list as a template including content,
by going to list settings >>"Save document library as template", you get this error message: "The list is too large to save as a template. The size of a template cannot exceed 524288000 bytes."

SharePoint 2013 version's Error message:

Same old stsadm can help to increase the template size limit in both SharePoint 2010 and 2013.

Using PowerShell to Get/Set SharePoint list template maximum size:
Its also possible to use PowerShell. Here is an example of setting SharePoint 2010 list / site template maximum size:

Just copy
attachment files from these folders and navigate to the target document library and paste there.

Well, it would be tedious to copy list attachment to document library, if you have large number of list items/attachments. So, lets use PowerShell in SharePoint to copy list attachment to document library.

Recently, We patched one of our SharePoint 2013 environment and ran SharePoint products configuration wizard without any issues. However, we noticed that the server status is still in "Upgrade Available" for SharePoint application & Web front end server from Central Administration > System Settings > Manage servers in this farm page. Ideally the server status should read "No action required" if everything goes good.

The "Upgrade available" simply means that there is a newer patch available at the SharePoint Updates page than the one installed on your SharePoint farm. We checked the Farm version and made sure its the latest available version.

Tried: psconfig -cmd upgrade -inplace b2b -wait and then restarted servers. Made sure windows updates are up to date on these servers. Solution:
Found this issue is
related to either some of the content databases/sites which still needs upgrade!

Run: stsadm -o localupgradestatus from any of your server stating the "Upgrade Available" status. You should get a summary like:

[5] content database(s) encountered.
[1] content database(s) still need upgrade or cannot be upgraded.
[10] site collection(s) are contained in the content databases.
[4] site collection(s) still need upgrade.
[53] other objects encountered, [0] of them still need upgrade or cannot be upgraded.

Based
on the summary, you have to either upgrade your SharePoint database or sites
(Upgrade-SPContentDatabase, Upgrade-SPSite). Once done with your site or database upgrade, run PSConfig wizard again.

What is Proxy Group in SharePoint?
SharePoint 2016 groups service applications together for consumption of the web application through proxy groups. These are simply groupings of service applications that you can deploy to different web applications.

Default proxy group in SharePoint 2013
SharePoint Proxy groups associates service application proxies with Web Applications. By default, SharePoint creates a proxy group called "Default" and adds new service applications to "Default Proxy Group" when created via SharePoint central administration. A Service Application Proxy can be associated with multiple Proxy Groups using PowerShell. Similarly, a Proxy Group is NOT required to host all available Service Applications within the farm.

You can get the available proxy groups by going to Central Admin >> Application Management >> Manage Web Applications >> Select any web application and click on "Service Connections" from the ribbon.

When you create web applications, you can select "custom" group under service application association, and pick relevant service applications from the list. This lets that specific web application to consume the selected services (and this custom selection is not re-usable!).

While creating Service applications through PowerShell, You have to explicitly specify "-DefaultProxyGroup" switch to add the service application proxy to default group.

Manage Proxy Group in SharePoint 2013 using PowerShell
To provide custom service applications grouping to web applications, you can create a new proxy group! There are no UI in SharePoint to create our own proxy group. So, Lets create a proxy group in SharePoint using PowerShell:

Problem: A faulty solution installed on the SharePoint farm created duplicate lists in all sites in a large site collection with 100+ sites in it. We had to remove them all!

To delete a list from SharePoint, from the browser, we can go to: View All Site Content >> Click on "Remove" link from the context menu of the list. Alternatively, You can get into List Settings >> click on "Delete this list" to remove a list in SharePoint.

However, There are 100+ sites where a particular list needs to be deleted.

#Site URL variable
$SiteURL ="http://intranet.crescent.com"
#get the site collection
$Site = Get-SPSite $SiteURL
#Loop through each site in the site collection
Foreach($web in $site.Allwebs)
{
#Call the function to delete list
Delete-SPList $web.URL "ConfigListv1"
}

Force delete delete corrupt SharePoint list using PowerShell:
In some cases, you need PowerShell's help when you are unable to delete list from SharePoint web UI as the list is corrupted and SharePoint won't let you to remove it, Use this script to remove SharePoint list using PowerShell: Force delete corrupted list in SharePoint using PowerShell