I am a SharePoint Administrator and new to both SharePoint Development and Sp 2013, and trying to learn development working on my own environment. What I want to achieve is to create a new announcement Content Type with a publish/start date. So whenever someone creates an announcement with this new type, it will be effective with the start date. I know there are ways to do this with No code, setting up views workflows etc. I am already aware of this ways and I am not asking on how to do this. I am trying to understand the new SharePoint add-in development techniques and using this example as a practice. I am trying to plan ways to achieve this and see which is the best way to do.

So far from what I have read, I understood that I can do this in 2 ways:

1- Farm solution I can create the content type, and create a timer job to publish the announcements or write a workflow to handle the start date publishing (again I know this could be done no-code, but just to understand how it works..)

2- Provider hosted add-in This is where I got confused. Some resources say you can get content types in apps, some say you can't. I find it very difficult to understand what you can do in apps/add-ins and what you can't. I understand that I can write a provider hosted app on an IIS box, and get the content type in, and a custom workflow. And as SharePoint is evolving to cloud, this is the best way to write custom functionality on SharePoint?

Can you please advise, if my understanding is correct?

Thanks in advance.

2 Answers 2


So you have asked quite a heavy question(s) and I will do my best to answer them for you.

Farm Solution

So basically this is where you can do nearly anything you want. You have access to all SP artifacts (lists, items, list instances, Content Types, etc). You can add business logic directly to your lists and their items and manipulate data quite easily. You have access to extensive development libraries within the SharePoint environment that have been added and refined over a number of years. You can even achieve what you want with a few lines of code in an Event Receiver instead of a work flow.
However, you are also playing with a fairly major component of the SharePoint lifecycle and something that has plagued many an environment... the ability to upgrade. Every time you create a custom farm solution you run the risk of affecting the ease at which you can upgrade your environment as a new version of SP may not be compatible with your code. This is one of the main reasons Microsoft has moved away from the Farm solution and moved into the Add-In model.


Add-Ins are of course different. They are focused on existing within the web or page they are added to. They also are focused on client (browser) code. However, there is absolutely no reason why you can't add most of the SharePoint artifacts to your environment. In fact, there is a list of what you can add. You can find it here. If you ware looking for ways to accomplish this, Microsoft does provide a really good write-up on adding lists, content type and site columns. You can read up on it here. The biggest thing to remember and you already started along it is that Add-Ins are designed to work in both an on-premise version of SharePoint and O365. Farm solutions will not work in O365, though nearly all functionality that you can do in a farm solution can be recreated in an Add-In if you try hard-enough. To handle your particular question, you can set the date to current within an add-in without actually using a WF. You can have it set before SharePoint actually saves the data to the list. I provided an answer the other day for this. In the Client Side Object Model, there is a function called PreSaveAction. If you utilize it, then you can update fields and check data before the form is sent into SharePoint. You can find my answer here.

Hope this helps. Let me know if you have any other questions around this.

  • Thank you so much for your detailed answer. Exactly why I want to stay away from farm solutions is because I think it should be the last resort, as it's a pain to look after,maintain upgrade, etc. I'm going to have a look at the client side object model example. Thanks!
    – ova
    Jan 19, 2016 at 9:07

One of the peculiarities of the add-in model is that when you declaratively create things like content types within the add-in solutions that you're working with, they are only available within the add-in (or app) web. This is true for both SharePoint hosted and Provider Hosted add-ins.

To make the content type available within your host web you could use a Farm solution as you've already indicated, but a better alternative would be to use a basic provisioning pattern from within an add-in to programmatically create and/or manage the new content type within your host web.

Another alternative would be to use a no-code sandbox solution (using only declarative elements - no custom code within the solution... sandbox solutions with custom code are officially deprecated). This does have some limitations, namely that sandbox solutions need to be enabled on the server you're working with, but can be an easy way to accomplish what you're looking for while using the tooling in Visual Studio but avoiding the problems of a farm solution. I do tend to like provisioning solutions better than this option though because they're more flexible and make it easier to manage your customizations in the future.

To clarify, you can accomplish what you're looking for from a SharePoint hosted add-in, a provider hosted add-in, a "no-code" sandbox solution, or a farm solution.

There are many examples of how to solve this type of problem using both JavaScript only SharePoint hosted add-ins and C# based provider hosted add-ins at the Office Dev Patterns and Practices Github repository (do a find for "Provisioning" on that page). You can also find a good course on Microsoft Virtual Academy called "Transform SharePoint Customizations to SharePoint App Model" with a module specifically on the provisioning pattern for add-ins. The MSDN article Create SharePoint content types by using CSOM provides a useful overview of programmatically creating content types using the CSOM (C# - you can translate into JavaScript Object Model code with a moderate understanding of JavaScript and executeQueryAsync)

The provisioning pattern is a great way to take things you would have done to modify your host web in the past with farm solutions and take those processes outside of SharePoint. This makes your installation more stable over its lifetime and easier to upgrade when the time comes (wether you're upgrading from on-prem to the new on-prem version, on-prem to the cloud, or one cloud version to another)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.