Thursday, 16 April 2015

Understanding Content Type Hub (CTH) in SharePoint 2013

In this article, I would like to make a step by step walk through of creating Content Type Hub in SharePoint 2013. Topics I would like to cover in this blog are:

  1. What is a Content Type?
  2. What Content Type takes with/includes in it?
  3. What is Content Type Syndication?
  4. What is Content Type Hub?
  5. How to set up Content Type Hub in your Farm?






What is a Content Type?
According to Microsoft, A content type is a reusable collection of metadata (columns), workflow, behaviour, and other settings for a category of items or documents in a Microsoft SharePoint Foundation 2010 list or document library. Content types enable you to manage the settings for a category of information in a centralized, reusable way.
For example, imagine a business situation in which you have three different types of documents: expense reports, purchase orders, and invoices. All three types of documents have some characteristics in common; for one thing, they are all financial documents and contain data with values in currency. Yet each type of document has its own data requirements, its own document template, and its own workflow. One solution to this business problem is to create four content types. The first content type, Financial Document, could encapsulate data requirements that are common to all financial documents in the organization. The remaining three, Expense Report, Purchase Order, and Invoice, could inherit common elements from Financial Document. In addition, they could define characteristics that are unique to each type, such as a particular set of metadata, a document template to be used in creating a new item, and a specific workflow for processing an item.
What a content type includes in it?
Content Type in SharePoint includes following details with it:

  • The metadata, or properties, you want to assign to this type. These are represented by site columns added to the list or document library when you add the content type. For more information, see Columns.
  • Custom New, Edit, and Display forms to use with this content type. For more information, see Custom Information in Content Types.
  • Workflows available for items of this content type. These can be defined to start automatically based on a selected event or condition, or through user selection. For more information, see the Workflow Associations property.
  • For document content types, the document template on which to base documents of this type. For more information, see Document Template Element (Content Type).
  • Any information necessary for custom solutions that are associated with this content type. You can store this information in the content type as one or more XML documents. For more information, see Custom Information in Content Types.
What is Content Type Syndication?
It is new feature that is part of the Managed Metadata service in SharePoint 2010. It solves a long-standing problem from SharePoint 2007, which is how do I create an enterprise library of content types and synchronize them amongst many different site collections. We often had to design and build solutions to work around this issue in SharePoint 2007, but now we have something that we can use out of the box.

In moss 2007, you have a Site Collection in Web Application1 and you have created a series of content types to use. Now, you create Web Application2 and find the necessity to reuse the content types created in Web Application 1. There is no way you could share or reference those content types created in Web Application1 in Web Application2. The only way possible is to create or write an application which would install those content types. This situation is pretty common in large organizations. This can be even considered for exposing base content types you use across multiple web applications in the farm.

What is Content Type Hub?

SharePoint 2010 introduced a new feature called Content Type Hubs to solve it. Content Type Hub is a central location where you can manage and publish your content types – so now web applications can subscribe to this hub and pull down the published content types from the hub. Even receive updates on the published content types. Don’t you think it is of great value? Same feature continues to be in SharePoint 2013.

Provisioning a site to be Enterprise Metadata hub site for your Farm

Given is the step by steps approach to provisioning a site for CTH. Just follow the steps and you are done.

1. Create a web application and a root site collection.


2. Create a new root site collection for the new web application. I choose developer site template. I think we can go for any templates available.

3. Activate the “Content type syndication Hub” of the site collection. Go to Site Settings -> Site Collection Features 


4. Activate Content type syndication hub site collection feature. What is being done is provisioning a site to be Enterprise Metadata hub site.


5. Setting up Managed metadata service in Manage Service Applications from Central Administration.
5.1. Go to Central Administration, click the Application Management, under Service Applications, and click the Manage Service Applications. In my case link was http://sp2013:xxxx/applications.aspx



5.2. Creating a new Managed Metadata Service using ribbon button. 


5.3. Adding required field values in the service creation dialogue





5.4. Entering Content Type Hub URL


5.5. New Managed metadata service and its connection are ready


5.6. Click on the Managed Metadata service. Make sure there is not error. I met with an error when I clicked. Solve the issues and go ahead. The error, I encountered is given below


This blog helped me to solve my issue. Hope this might help you as well.

5.7 Check if Metadata service is started or not


5.8 If not running, start it

5.9. Verify the properties of the Managed metadata service are entered properly especially Content Type Hub URL. Also tick the box below as shown in figure and Click OK.





5.10 Now select the Managed Metadata Service Connection, and then click Properties as shown below. What is important is “consume content type from the content type gallery”





6) Now, go to our content type hub site [which created in first step], Go to Site Actions and then Site Settings. Under Galleries click on Site Content Types, you will find default Content Type Available.


8) Create a new content type so that we get a clear picture of what is happening


9. Click on the new content type and you can see all the new fields added and any other options attached to the content type.


10) Click the Manage content type publishing and Check the Publish Radio button and say OK.

11) This will publish the content types

In order to receive the published content types immediately in the subscribers, you can go and run two timer jobs immediately: Go to Central Admin and run the timer jobs

11. 1) Content Type Hub


11.2) Content Type Subscriber (of the web application which is going to receive the content type’s updates)


11.3) Verify the time job status in the Central Admin

12. Published Content Types
After running the timer jobs, the content types should be published. Go to Site Settings | Site Collection Administration | Content Type Publishing. Check the Refresh all Published Content types on next update and say OK.


13. To verify the published Content Types
13.1 Create a Site collection of same or different Web Application

13.2 Go to the Site Actions -> Site Settings. Under the Galleries click the Site Content Types you will be finding the Site Content type which we created in above Site Collection.


14. By default, content type in the subscriber site collection is read only.


15. In Content Type Hub site collection you can do all kinds of setting to the content type including the workflow setting, Information policy setting etc.




16. Modifying content type in Content Type Hub: Let us modify the content type in the Content Hub by adding a new column. New column “image” is added




17. Republish


18. New field is available in the subscriber site collection


19. Workflow and Content Type Hub: Adding OOT workflow to the content Type Hub works fine. Example, here I am adding a disposition Workflow to the content which is in our discussion




20. Points to remember when you work with Custom workflow and Content Type Hub
Content Type Hub will not copy custom workflows to other Site Collections. You have to manually copy the workflow to the subscriber site collections. SharePoint Designer based workflow and also workflow created from visual studio, they all are working as expected given that I deployed these workflow to the subscriber site first before publishing the content type.
21. How you should approach publishing workflow with Content Type Hu
  1. Create a workflow and associate it with your content type in the hub.
  2. Before publishing this content type, export the reusable workflow and import it in all the subscriber site collections or deploy your workflow to the farm if it is a farm solution
  3. Activate your workflow feature
  4. Now, your workflow is available in the hub as well as all the subscriber site collections.
  5. Publish the content type. The workflow association will be published.

References:

Monday, 30 March 2015

How to create host header Web Application in SharePoint 2010

When you create a web application in SharePoint 2010 you specify IIS web site name and a port number to which the web application will be running on, and to browse that web application you normally enter the server IP address and port number in the http url (e.g http://ServerIPAddress:portanumber) or you enter the machine name and port number. If you want to avoid entering IP Address or server machine name in the url and wanting to browse the web application by a domain host name e.g mywebapp.testdomain.com, there is an option called Host Address, while creating the SharePoint web application  you can specify the fully qualified host address which you will use for browsing the web application.
Below steps shows how you can specify the host address and configure it to route the request to your SharePoint web application.
Step1: First you need to decide the host name, let’s say your domain name is testdomain.com, and you want to create a web application with host address mywebapp.testdomain.com
Step2: Now you need to create a DNS entry on your AD server. Open the DNS from Start->Administrative Tools as shown in below screen shot

Step 3:  Explore your domain name testdomain.com and right click to create New Host (A or AAAA) entry.




 
Step 4:  Specify the new host name and IP address of your SharePoint WFE where your web application will be deployed

  
Step 5:  Once the DNS entry is done, you need to make Registry entry on your SharePoint WFE server. To make registry entry on the WFE server, just type regedit in Start->Run window
From the Registry Editor, explore HKEY_LOCAL_MACHIN -> System -> CurrentControlSet -> Control -> Lsa -> MSV1_0  as shown in below screen shot and edit the BackConnectionHostNames and specify fully qualified host name.

Once the registry entry is done, it is recommended to restart the server.
Step 6: Now you can create a web application in SharePoint 2010 from Central Administration and use the host header mywebapp.testdomain.com

Once the web application is created, you can create a root site collection. Now you can browse the web application by using the host header and specified port number (http://mywebapp.testdomain.com:port/)

Note: In your intranet if it still does'nt render the web application by browsing it by host adress, just make sure 1) you have entered the host address in your browser proxy 2) host address and IP address entry in host file on your local machine (Start->Run, type drivers and enter, click on etc folder you can see host file)

Authentication Error with SharePoint Application which uses Host Header on the Server firm

This is known issue with SharePoint 2007 or SharePoint 2010 on Windows Server 2008 platform and not specific to any sharepoint application.
Problem: Your windows credential doesn’t work if you try to log in to the web application (http://contosto.company.com) on the server itself although you can access the same site from outside, when you create a SharePoint web application with a host header (contosto.company.com) on SharePoint Server (Server Name: contosto) which is installed on Windows Server 2008. This problem is happening with the recent patches.
image
If you check the event viewer logs on “Security” category, you will see something like the one below under Audit Failure Keyword
image
The main reason for this issue is Windows includes a loopback check security feature that helps prevent reflection attacks on your computer. Therefore, authentication fails if the FQDN or the custom host header that you use does not match the local computer name as the system blocks the authentication procedure while resolving the host header given to the web application.
To resolve this issue, a modification must be done to the server's registry to specify the host name. To specify the host names that are mapped to the loopback address and that can connect to Web sites on your computer, follow these steps:
  1. Click Start, click Run, type regedit, and then click OK.
  2. In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
  3. Right-click MSV1_0, point to New, and then click Multi-String Value.
  4. Type BackConnectionHostNames, and then press ENTER.
  5. Right-click BackConnectionHostNames, and then click Modify.
  6. In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
  7. Exit Registry Editor, and then restart the computer.
image
The name placeholder is considered a host header. It is an alternative name for the computer on which Reporting Services is installed. You must add the NetBIOS and the Fully Qualified Domain Name (FQDN) for name to the BackConnectionHostNames list that is stored in the Windows registry.
For example, if name is a Windows computer name, such as contoso, the name can likely also be referenced in FQDN form as contoso.domain.com. You must add both representations to the list in BackConnectionHostNames.
So, The above registry modification must be done for all other SharePoint applications which are using Host Header.

Authentication Error with SharePoint Application which uses Host Header on the Server firm


















 
 

Reason: The main reason for this issue is Windows includes a loopback check security feature that helps prevent reflection attacks on your computer. Therefore, authentication fails if the FQDN or the custom host header that you use does not match the local computer name as the system blocks the authentication procedure while resolving the host header given to the web application.
To resolve this issue, a modification must be done to the server's registry to specify the host name. To specify the host names that are mapped to the loopback address and that can connect to Web sites on your computer, follow these steps:


Solution:
§  Click Start, click Run, type regedit, and then click OK.
§  In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
§  Right-click MSV1_0, point to New, and then click Multi-String Value
§  Type BackConnectionHostNames, and then press ENTER.
§  Right-click BackConnectionHostNames, and then click Modify
§  In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
§  Exit Registry Editor, and then restart the computer