Featured post

Welcome

Welcome to my blog.
I am a Microsoft Certified Professional in C# with more than 10 yrs experience in Microsoft technology developing and designing different enterprise applications.
My specialty is developing SharePoint application in client side object model.
This blog will contain SharePoint codes and techniques which I’ve learnt while developing SharePoint applications.
Hope this blog will be helpful for you.
Enjoy reading and learning.

Add Multiple Content Type to a Library within a subsite

I have encountered a scenario where I need to add a content type from a library, but the library is within a subsite and the content types are defined at the root.

Using my code here won’t work because the content type can’t be (for lack of better word) access in a subsite. You can see it in the browser but it is like a hologram, you can see it but you can’t touch it.

So how do we solve this issue?
We use the context.Site.RootWeb.ContentTypes

See below code in action.

Check user permission

Hide Content Type Columns of a Library/List

Create Document Set in the library/list

Set Default Value on Library/List Columns

Delete “All Documents” View

Add Multiple Content Type to Library base on Content Type Group

Get ContentType Ids of the Content Type Base from Content Type Group

Check if Library or List exists without using Exception

Look Ma, no exception!!! 🙂

How to Create View Programmatically in SharePoint 2013 using client side (CSOM)

or for multiple views you can do this

for the viewFields list, it is listed below.
Sorry if it’s all messed up, still looking for a better way to display this.

Or you can check it over here, a lesser messed up than my list but still messed up 😀