Thursday, September 26, 2019

Tip: SharePoint 365 CSOM Nuget Package

Which on to use for SharePoint Online, when you want to use CSOM to connect to it?

NOT To Use


To Use

The reason for this post is to let people know that whenever you someone try to execute some operations to SharePoint Online and receive the following error, when your codes seem to be correct:
Microsoft.SharePoint.Client.CollectionNotInitializedException HResult=0x80131509 Message=The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested. Source=Microsoft.SharePoint.Client.Runtime
The are two reasons for such scenario:

  1. Try to access some properties within the CSOM object namespace but did not execute the proper "Load" and "ExecuteQuery" functions. 
  2. Used the wrong library version. As indicated above the package shown in first picture is for SharePoint2010 whereas the second picture is for SharePoint Online.

Thursday, September 12, 2019

Tip: How to kill the WebHelper sub-processes from BitTorrent

It's annoying when you found out that some unidentified processes are hogging a lot of CPU resources while running BitTorrent to download some files. Since i know how to do programming, i've created a console application that constantly monitoring the process list for WebHelper sub processes and kill them when found. As you can see from the picture below, the program checks the process list every minute.
The simple application which makes use of C# and Windows Form can be retrieved from Git Hub.

Tip: How to get the internal name for SharePoint 365 list

Recently i was trying to do some CSOM coding for a project that requires files to be migrated to SharePoint 365. I created a list in the SharePoint web site and was trying to add new records to the list. I tried to use the "Display Name" for each column from the list in as shown in Diagram 1.

Diagram 1

As you can see from Diagram 2, the line of code that does not work actually makes use of the "Display Name".

Diagram 2

if you try to execute the code you will get the following error.

Diagram 3

In order to get the internal for all the columns, i have to go to the list settings and click on each column and to check the URL for the column internal name. You can see that in Diagram 4.

Diagram 4

The url actually contains the column internal name and you can copy the name from there. The other way which is not covered here is using code to retrieve the internal names.