Pages

Tuesday, August 27, 2013

Content Type Issues in SharePoint 2013



SharePoint 2013 developers are gonna have a hard time while dealing with content types. In previous version of SharePoint, SharePoint allowed existence of content type fields with similar internal names. Hence we were able to deploy the same field multiple times belonging to different content types.

In this new version of SharePoint 2013, it throws an error while deployment stating that ‘A Duplicate field <field_name> already exists’. Thus, in SharePoint 2013, Content Types being site-scoped features do not allow existence of fields with similar internal names.

That being said, we can always take some measures and precautions while creating and deploying our custom content types. I have jot down some steps to do the same as under -


- Make sure the sequence in which various content types are being deployed by looking at its manifest file.

- Include all the field definitions in the first content type and then re-use those field GUIDs in the subsequent content types. This approach would make it easy in terms of implementation

- Refer fields which are available out-of-the-box by SP 2013 (please note that these fields are different from what SP 2010 offered).


This would surely eliminate the duplicate field issue. Following are some of the content types and their respective fields available OOTB in a SharePoint 2013 blank site. The list is very long, hence i have mentioned only a few. You can get the entire list by running the following PowerShell script -

$site = Get-SPSite "http://<your_site_url_goes_here>/"
$web = $site.OpenWeb()
foreach($type in $web.ContentTypes)
{
"----------------------------------------------------------------------------------"
$type.Name
"----------------------------------------------------------------------------------"
foreach($field in $type.Fields)
{
$field | Select InternalName, Type
}
}

Here's an excerpt from the list -

------------------------------------------------------------------------------------
System
------------------------------------------------------------------------------------
ContentType                                   Computed

------------------------------------------------------------------------------------
Common Indicator Columns
------------------------------------------------------------------------------------
ContentType                                   Computed
KpiDescription                                    Note
KpiComments                                       Note
Value                                           Number
Goal                                            Number
Warning                                         Number
FormattedValue                                    Text
FormattedGoal                                     Text
FormattedWarning                                  Text
DetailLink                                         URL
LowerValuesAreBetter                           Boolean
UpdateError                                       Note
LastUpdated                                   DateTime
------------------------------------------------------------------------------------
Fixed Value based Status Indicator
------------------------------------------------------------------------------------
ContentType                                   Computed
KpiDescription                                    Note
KpiComments                                       Note
Value                                           Number
Goal                                            Number
Warning                                         Number
FormattedValue                                    Text
FormattedGoal                                     Text
FormattedWarning                                  Text
DetailLink                                         URL
LowerValuesAreBetter                           Boolean
UpdateError                                       Note
LastUpdated                                   DateTime
------------------------------------------------------------------------------------
SharePoint List based Status Indicator
------------------------------------------------------------------------------------
ContentType                                   Computed
KpiDescription                                    Note
KpiComments                                       Note
Value                                           Number
Goal                                            Number
Warning                                         Number
FormattedValue                                    Text
FormattedGoal                                     Text
FormattedWarning                                  Text
DetailLink                                         URL
LowerValuesAreBetter                           Boolean
UpdateError                                       Note
LastUpdated                                   DateTime
DataSource                                         URL
ViewGuid                                          Text
ValueExpression                                   Note
PercentExpression                              Boolean
AutoUpdate                                     Boolean
------------------------------------------------------------------------------------
Excel based Status Indicator
------------------------------------------------------------------------------------
ContentType                                   Computed
KpiDescription                                    Note
KpiComments                                       Note
Value                                           Number
Goal                                            Number
Warning                                         Number
FormattedValue                                    Text
FormattedGoal                                     Text
FormattedWarning                                  Text
DetailLink                                         URL
LowerValuesAreBetter                           Boolean
UpdateError                                       Note
LastUpdated                                   DateTime
DataSource                                         URL
ValueSheet                                        Text
ValueCell                                         Text
GoalSheet                                         Text
GoalCell                                          Text
WarningSheet                                      Text
WarningCell                                       Text
GoalFromWorkBook                               Boolean
WarningFromWorkBook                            Boolean
AutoUpdate                                     Boolean
------------------------------------------------------------------------------------
SQL Server Analysis Services based Status Indicator
------------------------------------------------------------------------------------
ContentType                                   Computed
KpiDescription                                    Note
KpiComments                                       Note
Value                                           Number
Goal                                            Number
Warning                                         Number
FormattedValue                                    Text
FormattedGoal                                     Text
FormattedWarning                                  Text
DetailLink                                         URL
LowerValuesAreBetter                           Boolean
UpdateError                                       Note
LastUpdated                                   DateTime
DataSource                                         URL
Trend                                           Number
KpiStatus                                       Number
DisplayFolder                                     Text
KPI                                               Text
IncludeHierarchy                               Boolean
AutoUpdate                                     Boolean
------------------------------------------------------------------------------------
Item
------------------------------------------------------------------------------------
ContentType                                   Computed
Title                                             Text
------------------------------------------------------------------------------------
Circulation
------------------------------------------------------------------------------------
ContentType                                   Computed
Title                                             Text
Body                                              Note
DueDate                                       DateTime
Confidential                                   Boolean
AllowEditing                                   Boolean
V4SendTo                                          User
Confirmations                                     Text
V3Comments                                        Note
WhatsNew                                       Boolean
------------------------------------------------------------------------------------
New Word
------------------------------------------------------------------------------------
ContentType                                   Computed
Title                                             Text
IMEDisplay                                        Text
IMEComment1                                       Text
IMEComment2                                       Text
IMEComment3                                       Text
IMEUrl                                             URL
IMEPos                                          Choice
------------------------------------------------------------------------------------
Category
------------------------------------------------------------------------------------
ContentType                                   Computed
Title                                             Text
CategoryDescription                               Text
CategoryImage                                      URL
TopicCount                                     Integer
ReplyCount                                     Integer
LastPostBy                                        User
LastPostDate                                  DateTime
------------------------------------------------------------------------------------
Site Membership
------------------------------------------------------------------------------------
ContentType                                   Computed
Title                                             Text
Member                                            User
MemberStatus                                    Choice
MemberStatusInt                                Integer
------------------------------------------------------------------------------------
Community Member
------------------------------------------------------------------------------------
ContentType                                   Computed
Member                                            User
MemberStatus                                    Choice
MemberStatusInt                                Integer
Title                                             Text
LastActivity                                  DateTime
NumberOfBestResponses                           Number
NumberOfDiscussions                             Number
NumberOfReplies                                 Number
NumberOfRepliesToReachNextLevel                 Number
ReputationScore                                 Number
HideReputation                                 Boolean
------------------------------------------------------------------------------------
WorkflowServiceDefinition
------------------------------------------------------------------------------------
ContentType                                   Computed
Title                                             Text
WSGUID                                            Guid
WSPublishState                                 Integer
WSPublishError                                    Note
WSDisplayName                                     Text
WSDescription                                     Text
FormData                                          Note
------------------------------------------------------------------------------------
InviteUser
------------------------------------------------------------------------------------
ContentType                                   Computed
Title                                             Text
EmailTemplate                                     Note
LoggedUser                                        Text
SentAt                                            Text
InviteUser_Recipients                             Note
CurrentSiteCollection                             Text
------------------------------------------------------------------------------------
Health Analyzer Rule Definition
------------------------------------------------------------------------------------
ContentType                                   Computed
Title                                             Text
HealthRuleScope                                 Choice
HealthRuleService                                 Text
HealthRuleType                                    Text
HealthReportCategory                            Choice
HealthRuleSchedule                              Choice
HealthRuleCheckEnabled                         Boolean
HealthRuleAutoRepairEnabled                    Boolean
HealthRuleVersion                                 Text


Sunday, August 25, 2013

Creating or Modifying Search Topology in SharePoint 2013


The Search service application introduced in SharePoint 2013 is different than that of SharePoint 2010 in more ways than just one.

To start with, SharePoint 2013 uses the web-based interface to change the current status of the topology. It can only be done by using Windows PowerShell. SharePoint Server 2010 also included a web-based option for changing the topology.

The Search Query web service is deprecated in SharePoint 2013. Search in SharePoint 2013 supports FAST Query Language (FQL) syntax and Keyword Query Language (KQL) syntax for custom search solutions. You cannot use SQL syntax in custom search solutions - FullTextSQLQuery was used for this purpose in SharePoint 2010. In SharePoint 2013, this class has been deprecated. It doesn't even support backward compatibility.

Custom search solutions that use SQL syntax with the Query object model and the Query web service that were created in earlier versions of SharePoint Server do not work when you upgrade them to SharePoint 2013. If you submit queries by using these applications, you will receive an error.

There are a lot more features which have been deprecated in SP 2013, thorough details of which you can find here.

The information I am going to share with you will help you configure your search service application to get it up and running for your sites. We will start with changing the default search topology and then move on the Search Service application configuration which I would cover in a different post. Please note that creating a new search topology is not a mandate if the Search is configured properly on your server.


Creating a Search Topology / Changing the Default Search Topology

For demonstrative purposes and making things easy to understand, I'll consider a farm consisting of only server. For multi-server approach, you may refer this link.

- Ensure that no crawls have been started and that the search index is empty on the server that hosts Central Administration.

- Verify that the user account that is performing this procedure is an administrator for the Search service application.

- In Central Administration, in the Application Management section, click Manage Service Applications.

- On the Manage Service Applications page, in the list of service applications, click the Search service application.

- Verify that the search index is empty. On the Search Administration page, under System Status, verify that Searchable items displays "0". Here, if the Searchable items are not zero, discontinue this process and make sure you click on 'Reset Search Index'. Only then move on with the next steps.

- Verify that no crawls have been started. On the Search Administration page, under Crawling, click Content Sources. On the Manage Content Sources page, verify that the Status column for any existing content source displays Idle.

- Start a SharePoint 2013 Management Shell on one of the servers in the farm.

- Specify the new servers you want to add search components to, start a search service instance (ssi) on these servers and create references to the search service instances. In this procedure we have used the example host name "server_name" for the server. At the Windows PowerShell command prompt, type the following command(s):

$host = Get-SPEnterpriseSearchServiceInstance -Identity "server_name"
Start-SPEnterpriseSearchServiceInstance -Identity $host


- Wait until all the search service instances are running. At the Windows PowerShell command prompt, type the following commands until the commands return the state "Online" for the search service instance:

Get-SPEnterpriseSearchServiceInstance -Identity $host

- Create a new search topology and a reference to the new search topology. At the Windows PowerShell command prompt, type the following command(s):

$ssa = Get-SPEnterpriseSearchServiceApplication 
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa

- Add all the search components to the new search topology. The following Windows PowerShell commands will create the search components of the new topology and assign them to the new server.
In this small enterprise search topology there is one index partition, index partition 0, to cater for a maximum of ten million items. This is indicated with the parameter -IndexPartition in the command New-SPEnterpriseSearchIndexComponent. 

At the Windows PowerShell command prompt, type the following command(s):

New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $host

New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $host

New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $host

New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $host

New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $host

New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $host -IndexPartition 0

 - Activate the new search topology. At the Windows PowerShell command prompt, type the following command:

Set-SPEnterpriseSearchTopology -Identity $newTopology

 - Verify that the new search topology is active. At the Windows PowerShell command prompt, type the following command:

Get-SPEnterpriseSearchTopology -SearchApplication $ssa

The command returns an overview of active and inactive topologies, in this example:

TopologyId     : 6E680C1A-14F3-4280-8524-CDBC52E0AEF2
CreationDate   : 8/24/2013 7:45:00 AM
State          : Active
ComponentCount : 6

The new active topology from this example will have a component count of six.

 - Verify that all components of the new search topology are running correctly. At the Windows PowerShell command prompt, type the following command:

Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

This command should return a list of all the active search components. The state of the active search components should be displayed as Active.

Voila ! Your topology is now ready for use :)