Technical blog archive

.NET King Technical blog
 This is the real Alireza! jumping from one technology to another every day. Here you can read my technical blogs. Just select the right category and enjoy.
 By the way, don't miss the general blog.

Adding and removing fields in SharePoint list using Client Side Object Model CSOM 101 - Part 3 (1/4/2017)

You create a SharePoint list and now you need to make some adjustments to the list. In this video you will see how to add or remove fields to the SharePoint list

47 comments by now. Add your comments
Adding and removing lists to SharePoint site using client side object model CSOM 101 - Part 2 (10/18/2016)
This is quite common situation that you need to add a list or library pro grammatically as a Provider Hosted App, add-on. This code simply shows you how to create a list in SharePoint or delete it.
10 comments by now. Add your comments
SharePoint Client Side Object Model tutorial - Part 1 (10/16/2016)
In this video series I started an easy to understand tutorial for SharePoint client side object model.
This specific video includes an overview of CSOM using C# and explains references and main .NET objects used to make a simple Windows application that connects to SharePoint 2013/2016.
5 comments by now. Add your comments
How to use CAML query in SharePoint Clinet Side Object Model (4/28/2016)

It has been my passion these days to work on CAML query. This passion has produced 7 videos so far. This video that I published last night shows you how to query a SharePoint list using CAML query and CSOM (Client Side Object Model).

7 comments by now. Add your comments
How to use CAML query on Lookup fields in SharePoint 2013 (4/24/2016)

In this video I present and demo how you can write a CAML query to filter the SharePoint list item based on Value and Key in a lookup field

122 comments by now. Add your comments
Working with DateTime field in CAML Query (4/20/2016)

This video covers the use of CAML query filtering SharePoint Date field.

Keywords: DateTime, Today, OffsetDays, IncludeTimeValue

10 comments by now. Add your comments
How to create a SharePoint External list from SQL Server using Business Data Connectivity Services and Secure Store Service (4/18/2016)

In this video you will see how to create a SharePoint 2013 external list based on the data from remote SQL Server database using SQL Authentication, Secure Store Service and Business Data Connectivity Service.

4 comments by now. Add your comments
How to use CAML query on SharePoint text fields (Equals, Contains, Begins With) (4/12/2016)
In this video you will see:
- Simple CAML Query structure
- Searching for exact string (Equals)
- Searching for part of the string (Contains)
- Searching for text starting with search string (Begins With)
- Searching for Less than or Greater than search string
- Combining search conditions (And/Or)
9 comments by now. Add your comments
Using C# and CAML to query the list items in SharePoint - SPQuery (4/8/2016)
After I learned that CAML query is the fastest way to query SharePoint lists and libraries, I was always obsessed about using CAML everywhere possible. I have done enough of CAML that I call myself a master in CAML development and now this is time to share what I learned after so many years. This is the start.
In this video I start a series of CAML query tutorial and I reveal lots of tips and tricks to build efficient CAML queries.
Here is the first video... Enjoy
34 comments by now. Add your comments
Accessing SharePoint user fields programmatically using C# (4/2/2016)
This video demonstrates how to get the content of SharePoint user field (person/group) programmatically.
7 comments by now. Add your comments
Assigning master page to a SharePoint 2013 site programmatically (Client Side Object Model) (11/3/2015)

As I mentioned in the previous post, I put a simple function together to assign the master page for a SharePoint 2013 website using Client Side Object Model (CSOM). This function can be simply used in a provider hosted App or a simple consol application.


// Client Side Object Model
/// <summary>
This function gets the site Url and master page name and assigns the new master page to the site
<param name="siteUrl">The URL of the site you'd like to change the master page programmatically</param>
<param name="masterPageFileName">The file name of the new master page
void setMasterPageCSOM(string siteUrl, string masterPageFileName)
ClientContext ctx = new ClientContext(siteUrl);
Web rootWeb = ctx.Site.RootWeb;
List masterPageList = rootWeb.Lists.GetByTitle("Master Page Gallery");
File newMasterPage = masterPageList.RootFolder.Files.GetByUrl(masterPageFileName);
    ctx.Load(newMasterPage, mp => mp.ServerRelativeUrl);
Web currentWeb = ctx.Web;
    currentWeb.CustomMasterUrl = newMasterPage.ServerRelativeUrl;
    currentWeb.MasterUrl = newMasterPage.ServerRelativeUrl;

51 comments by now. Add your comments
Assigning master page to a SharePoint 2013 site programmatically (Server Side Object Model) (11/2/2015)
It is always part of the branding a SharePoint to assign your newly developed/customized master page to the site and it usually takes some twigs to make it right. On the other side master page Url is a relative and things get complicated when you concatenate the strings to make that relative Url.
Below is a function with server side code. When I get a chance I put the same functionality together using CSOM.

// Server Side Object Model

protected void setMasterPageSSOM(SPWeb web, string masterPageFileName)


    SPFile masterPage;


        masterPage = web.Lists["Master Page Gallery"].RootFolder.Files[masterPageFileName];


        masterPage = web.Site.RootWeb.Lists["Master Page Gallery"].RootFolder.Files[masterPageFileName];

    web.CustomMasterUrl = masterPage.ServerRelativeUrl;

    web.MasterUrl = masterPage.ServerRelativeUrl;



152 comments by now. Add your comments
All of them futures from the variety of band that is definitely unquestionably alot more "jewelry-like" rather than a lot of panerai replica sale charms. Panerai replica sale plainly names it five-link band that "Pearlmaster, inches and contains a truly soft and even agreeable believe once heading that back-links plus having on the application. That 2015 rolex replica uk range contains a whole lot of parallels to a new one new-for-2015 cartier replica sale give off.