Skip to main content

Posts

Showing posts with the label C#

Read all the SharePoint User profile field using CSOM

The article shows CSOM and C# code to read all the user profile field. create a console application and copy the code below and replace the siteurl, user id and password with your sharepointURL , user id and password. You need to add three dll to run this code:- Microsoft.SharePoint.Client Microsoft.SharePoint.Client.Runtime Microsoft.SharePoint.Client.UserProfiles Add this dll and run the code. Enjoy Coding. using System; using Microsoft.SharePoint.Client; using Microsoft.SharePoint.Client.UserProfiles; using System.Security; namespace ConsoleApp1 {     class Program     {         static void Main()         {             using (ClientContext clientContext = new ClientContext(Yoursiteurl))             {                 string UName = "Your user name";               ...

how to create and delete folder using C#.

We can create, delete of check folder in c# using the Directory class. To create folder set the path(Location) on which you want to create the folder into  the variable, Here i am taking variable named folderPath.  1. To create folder/directory. string folderPath="E:\testing\";   if (!Directory.Exists(folderPath))           {             Directory.CreateDirectory(folderPath);           } 2. To delete folder/directory. This method used when the folder you want to delete is empty. string folderPath="E:\testing\test"; if (Directory.Exists(folderPath))             {                 Directory.Delete(folderPath);             } 3. To delete folder/directory with all the content. string folderPath="E:\testing\test"; if (Directory.Exists(folderPath)) ...