wiliammbr's blog

Some thoughts on SharePoint and other random stuff

Category: General (page 2 of 2)

Complete Operations on Lists with CSOM

Sometimes we have to reach a SharePoint list through remote connections using C#. It can happen in a SharePoint App, a Console Application or maybe on an Azure Worker Role.

Below you can find some code snippets that will help you on integrating SharePoint lists with your application.

Basically, you will have to add the Microsoft.SharePoint.Client namespace.

using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;

The required DLLs for programming these type of solution are:


You can find them inside those folders:

SharePoint 2010: 14 Hive -> Folder: ISAPI

SharePoint 2013: 15 Hive -> Folder: ISAPI

Or just download it from MSDN, inside the SharePoint Server 2013 Client Components SDK!

After adding these references to our project, we can start coding.

Soon you will notice that everything depends on the ClientContext object, which manages the requests and the data that will be loaded.

In our examples we are going to use the variable siteUrl, that represents the URL for the Site Collection. The variable listTitle will also be used and it represents the Title of the list being used.

string siteUrl = "http://sitesharepoint";
string listTitle = "SharePointList";

So, let’s do some real stuff here:

Reading SharePoint lists:

Filtering SharePoint lists and selecting specific fields:

Creating list items:

 Updating list items:

 Deleting list items:

I believe these are the basics for consuming SharePoint lists. In the future I’m planning to show some complex examples, more focused on Office 365 and Azure integrations. Thanks for reading and I hope it can be useful to you


Study Guide for Exam 70-488 – Developing Microsoft SharePoint Server 2013 Core Solutions

Since last year, we received the announcement that some of the SharePoint 2013 certifications were being retired in September of last year. But after that, they extended the deadline to 2017. This new deadline can be explained due there is no new certifications focused on development for SharePoint 2016 have been released yet.

Exam on Microsoft’s website: https://www.microsoft.com/pt-br/learning/exam-70-488.aspx

Therefore, here is a set of links that you can use as a study guide to pass on that exam before it is retired.
This summary was once made by Martin Bodocky and kept on this blog post “70-488 – Developing Microsoft Sharepoint Server 2013 Core Solutions – Preparation links“. Unfortunatelly, it’s not online anymore, so I decided to provide this information once again at the same time that I must say: Bodocky made everything and helped me on passing this exam, back on 2014.

If you want to read the preparation links for the Advanced Solutions, please check the post for the test Study Guide for Exam 70-489 – Developing Microsoft SharePoint Server 2013 Advanced Solutions.

Continue reading

Get user info programmatically in SharePoint

Once in a while we need to gather some user information and use it many ways. It doesn’t matter if you need to show a special message to an specific user using its Personal Name or maybe just fill an SPFieldUser in a specific list, you’ll probably need one of those snippets to do the trick.

I’m going to divide it into Server-side object model for C# users, REST API (for SharePoint 2013 projects or newer) and the old-fashioned JavaScript object model introduced in SharePoint 2010.
Continue reading

Troubleshooting errors in SharePoint using Powershell and Get-SPLogEvent

Today I would like to share with you an useful way to troubleshoot errors in your SharePoint site when some unexpected error occurs.
You will need two things: the Correlation Id and access to Powershell or SharePoint Management Shell on the server. Once you got these two things, just paste the code below replacing the CorrelationId parameter with your Id.

This example is extremely simple, but saved my life a thousand times. The Get-SPLogEvent accepts other parameters too like Start and End Time too, that will help you on filtering better. Here is how the Log will be formatted in the text file.


Hiding Empty Content Query Web Part

For those who want to hide their Content Query Web Parts if they don’t return any data and at the same, who don’t wanna dive into the XSL world, you can just add this code snippet to your pages and VOILÀ.

It’s up to you if you want to set this behavior to every page in your Web Site putting the code in a global JS file, or just for an specific one using a Script Editor Web Part to do the trick.



Two years ago I abandoned my old Blogspot site where I used to talk about SharePoint, in Portuguese. I had to leave it behind due my opportunity to study abroad in Japan for one year, by a government program called Science without Borders that was letting Brazilian students to study in a country of their choice.

BUT NOW I’m back to Brazil and already settled into this wonderful culture, so I’ve decided to restart my old project and to try again building this website and publishing information that I find useful. Actually it won’t be just a common blog, because I’m also going to try some fancy stuff working on a personal website which I have more tools to invent and publish new content about not just SharePoint, but other topics. Well, I must admit that the main focus will be SharePoint and Office 365.

SharePoint    Office 365

You can see below my objectives:

  • Share some experiences that I will have working with SharePoint and .NET;
  • Discuss ideas about best practices for coding, performance and information architecture;
  • Promote some nice content from other bloggers or websites that usually help me in my daily tasks.

Well, I hope I can help you someday and that we can find ways to solve problems together too!

Here we go!

Newer posts

© 2018 wiliammbr's blog

Theme by Anders NorenUp ↑