Friday 25 October 2013

External Content Type and SharePoint Online - BCS with OData

As of now, SharePoint Online supports only BCS model with OData (Open Data Protocol) Services. So let us see what this OData and how to create an “External Content Type” using Visual Studio 2012 for SharePoint 2013 Online.

What is OData?
The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (Atom Pub) and JSON to provide access to information from a variety of applications, services, and stores.
My development environment:
  1. Visual Studio 2012
  2. Office Tool For VS 2012  OfficeToolsForVS2012RTW.exe
  3. SharePoint Office 365
Consuming OData Data Sources in SharePoint 2013 Online through Business Connectivity Services(BCS).
1. Launch Visual Studio 2012 and create a new project using apps for SharePoint 2013
2. Enter the name of your app for SharePoint, name of the site where to host the apps and how do you want to host your app.
3. This is the structure of our new project
4. To add an external content type, right-click your project and choose “Add a new item”. You will see a new menu item called “Content Types for an External Data Source..”. Click on it.
5. Time to configuring the “External Data Source”. For demo sake we can use a public OData Service provided by http://tv.telerik.com/services/odata.svc/
6. Select data entities for which you want to generate external content types. Also check “Create list instance for the selected entities” option so that an instance will be created automatically when package is deployed to the site.



7. Looking at the structure we can see that “Content Type” and “List Instance” are added to the project
8. Mark up of the “List Instance” created
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 <ListInstance Url="Lists/Videos" Description="Videos" OnQuickLaunch="TRUE" Title="Videos">
   <DataSource>
     <Property Name="LobSystemInstance" Value="TelerikODataDataSouce" />
     <Property Name="EntityNamespace" Value="TelerikTvDataServiceDataServiceModels" />
     <Property Name="Entity" Value="Videos" />
     <Property Name="SpecificFinder" Value="ReadSpecificVideo" />
     <Property Name="MetadataCatalogFileName" Value="BDCMetadata.bdcm" />
   </DataSource>
 </ListInstance>
</Elements>
9. Time to deploy the solution. Right click the project and click on the “Deploy”
10. Browse your site to see the “External List Instance” that is just created by Visual Studio 2012.
11. Click on the List Instance and you will see a page like this
12. View the list of installed apps

13. We can find the newly created “External Content Type” by going to view all contents page of the site.

14. We are done and we can see all items in the List now.

Summary

Working with SharePoint 2013 and OData Model is quite easy. I will find some time in the future to make CRUD options with OData as well. Hope you enjoyed reading it.  Please leave your comment/views when you find it useful that will help me a lot
Ref: http://zimmergren.net/technical/sharepoint-2013-business-connectivity-services-consuming-odata-in-bcs-using-an-app-external-content-type

Monday 21 October 2013

Configuring SharePoint 2013 to support workflow Management Service

Configuring SharePoint 2013 to support workflow Management Service

By default, in SharePoint 2013, Workflow Manager Service is not configured. Workflow Manager Service has to be downloaded, installed and configured manually before it can be used in SP 2013. Here is a step by step walk-through.  
Step 1: Open Microsoft Web Platform Installer
My version of WPI is 4.5

Step 2: Search for Workflow. You will get the below list


Step 3: Select Workflow Manger 1.0, click Add and then "Install"
Step 4:  Click on "I Accept"

Step 5:  Click on "Continue"

Step 6:  Click on "Continue"

Step 7:  Click on "Configure Workflow Manager with Custom Settings"

Step 8:  Click on all " Test  Connection" buttons


Step 9:  Supply User details and Passwords


Step 10:  Accept the defaults  and check "Allow Workflow management over HTTP on this computer" option as your system is not configured for HTTPS.

Step 11:  Next task is Service Bus configuration.



Step 12:  Do test connections and select "use the same account" and "use the same certificate" options.



Step 13:  Accept the summary screen


Step 14:  Now, installation in progress and it will take couple of



Step 15:  Installation complete




Step 16:  Check Application Pool "WorkflowMgmtPool" running or not

Step 17:  Check web site "Workflow Management  Site" running or not


Step 18:  Install Cumulative updates. First install cumulative update of Service Bus





Step 19:  Install Workflow Manager 1.0 Cumulative Update 1




Step 20:  Do IIS RESET
Step 21:  Workflow Service Status will still remain "Not Connected"

Step 22:  You need to register "Workflow Manger". For that, Open Management Shell


Step 23:  Give this command "Register-SPWorkflowService -SPSite "http://xxxx" -WorkflowHostUri "http://xxxx:12291" - AllowOAuthHttp

Step 24:  Refresh the page. Your Workflow Service Status is "connected" now.


Step 25:  You can also verify this using SharePoint Designer. For that, connect to the server



Step 26:  Select Workflow, click on List workflow. Check the platform type by clicking on Platform Type Selection box. You will see both SharePoint 2010 Workflow and SharePoint 2013 Workflow.


Leave a comment when it makes your task easy. Good Luck!

Monday 7 October 2013

Understanding Content Type Hub (CTH) in SharePoint 2013/2010

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, behavior, 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 dialog


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 CTH
  • Create a workflow and associate it with your content type in the hub.
  • 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
  • Activate your workflow feature
  • Now, your workflow is available in the hub as well as all the subscriber site collections.
  • Publish the content type. The workflow association will be published.
Please leave a comment it really helped you. Also if you have anything to add, please update me @ tbijujoseph@gmail.com


References: