Skip to main content

Posts

Showing posts with the label Client Side Object Model

How to check permissions of user on sharepoint list using csom.

In this article, we are going to learn "How to check the permissions of user on SharePoint list using csom " or permissions of user using code. In provider-hosted SharePoint Add-ins, we use the csom code and to check the permission of the user on a particular list, once we get the effective permission of particular user on the SharePoint list and then by using that permission we can check the particular kind of permission like Addlistitem, Editelistitem, etc. In this example, we have created a console application to check whether the user has edit permission on the list or not.  Pass the client context, email of the user and list name on which you want to check the permission of the user. using System; using System.Security; using Microsoft.SharePoint.Client; namespace PracticeCsom {     class Program     {         static void Main(string[] args)         {            s...

Insert item in list using CSOM SharePoint

To insert item into list using csom code. You can create a consol application using visual studio and also use the code mentioned below. You can interact  with sharepoint list using JSOM,CSOM or using rest api. List operation using csom. using Microsoft.SharePoint.Client;  using System;  using System.Collections.Generic;  using System.Linq;  using System.Security;  using System.Text;  using System.Threading.Tasks;  namespace ConsoleApp1 { class Program { static void Main(string[] args) { using (ClientContext clientContext = new ClientContext("insert url upto list")) { string Uname = "Your ID"; string password = "Password";  SecureString Securepasseord = GetSecureString(password);  clientContext.Credentials = new SharePointOnlineCredentials(Uname, Securepasseord); clientContext.ExecuteQuery(); List oList = clientContext.Web.Lists.GetByTitle("metalist");  ListItemCreationInformation listCreationIn...