Featured post


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.

Get ContentType Id base on ContentType Name(s)

Check if file exists in subfolder without using an exception

If you check the blog post in “Check if file exists in list/library without using an exception”
the method here is somewhat similar, with some few additional tricks

Here we need serverRelativeUrl variable

The key here is in the xmlQuery, we added Scope=’RecursiveAll’, which looks entirely in a library, but we will limit the search only to our location with

and {1} is the serverRelativeUrl

Check if file exists in list/library without using an exception

This is all well and good, but this won’t work if the file is in subfolder.
See “Check if file exists in subfolder without using an exception”

Get Columns or Fields of a Content Type

Get Content Type of a File in a List/Library

Get Content Type of a List/Library

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