Skip to main content

Posts

Retrieve List Items using JSOM.

To return or get items from the list you have two options if you want to retrieve the single item you can use the GetItemById() method or for multiple items use GetItems(CamlQuery). Replace the siteUrl with your siteUrl for example ("xyz.sharepoint.com") and TitleOfList with your title list from which you want to get the items. Code to get the list item using the ID.  function getListiem(){ var context = new SP.ClientContext(siteUrl);  var list = context.get_web().get_lists().getByTitle('TitleOfList');  var targetListItem = list.getItemById(listItemID); context.load(targetListItem); context.executeQueryAsync(onGettingRecord, onFailedCallback); } function onGettingRecord(){ alert(targetListItem.get_item('Title')); } function onFailedCallback(sender,args){ alert('Request failed. ' + args.get_message() + '\n'+args.get_stackTrace()); } Code to get multiple items from the list. function getItems(){ var...

Content editor web part missing in SharePoint/Modern SharePoint.

Media and content editor web part missing in SharePoint online. At Some Point, you need to add content editor web part into the modern site but the content editor web part did not appear on the page, to appear content editor web part on page you need to follow the below steps. 1 Log in as the SharePoint Global Administrator or SharePoint Administrator. 2.  Log in and navigate to your site collection ("https://xyz.sharepoint.com") and under the site settings activate the below features.   Site settings – site features – SharePoint Server Publishing .   Site Settings – Site Actions – Manage site features- SharePoint Server Publishing Infrastructure.                For this, you also need to enable Custom site scripts on your site collection(But In Modern SharePoint Its not recommended to enabling custom site scripting)  For this go to the  SharePoint Admin center – Settings -  Classic settings page (op...

Update SharePoint list item using JSOM.

In this blog, we are going to learn how to update the SharePoint list item using the JSOM. To update the SharePoint list item or delete it, we can do this using the help of item id. Here we are performing an operation on the list named "Info", which have two columns "Name" and "Address".  Replace "***.sharepoint.com" with your tenant URL and replace the ListItemID with your item id. var clientContext = new SP.ClientContext('***.sharepoint.com'); var oList = clientContext.get_web().get_lists().getByTitle('Info'); var oListItem = oList.getItemById(listItemID); oListItem.set_item('Name','xyz');  oListItem.set_item('Address','xyz');  oListItem.update(); clientContext.executeQueryAsync(Function.createDelegate(this, this.ItemUpdate), Function.createDelegate(this, this.onQueryFailed)); function ItemUpdate(){ alert('Item updated'); } function onQueryFailed(sender,args){ alert('...

Delete Item from the SharePoint list using JSOM.

In this blog, we are going to learn, how to delete SharePoint List item using JSOM/JavaScript. We are going to delete the list item from the SharePoint list using the ID. var clientContext = new SP.ClientContext("URL of your sharepoint tenant"); var oList = clientContext.get_web().get_lists().getByTitle('Title list '); oListItem = oList.getItemById(1)); oListItem.deleteObject(); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQueryDelete), Function.createDelegate(this, this.onQueryFailed)) after successful execution of the function, it calls the onQueryDelete function and when it get failed it throws an exception. Happy Coding!!!!!

Add list item in SharePoint List using Jsom.

In this blog, we are going to learn how to add list item into SharePoint List using Jsom/JavaScript. Step 1:  Create a list named "Info" with two-column named Name and Address. Step 2: Get the value of your HTML control and use this code to add an item.On Place of the "XYZ" pass value of your control. var ctx = new SP.ClientContext("URL of your site");   var oList = ctx.get_web().get_lists().getByTitle('Info');   var createiteminfo = new SP.ListItemCreationInformation();   this.ListItem = oList.addItem(createiteminfo);   ListItem.set_item('Name',"xyz");   ListItem.set_item('Address',"xyz");   ListItem.update();   ctx.load(ListItem);   ctx.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); On the success of this function, it calls onQuerySucceeded() function and when it throws some exception onQueryFailed() functi...

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";               ...

SharePoint user profile fields with their internal name.

We can update the SharePoint user profile fields manually or programmatically. Also using a power shell, we can update the user profile fields. For updating the SharePoint user profile field need to enable the  Allow users to edit values for this property, SharePoint Admin can enable this property. Display Name  Actual Name Type Id UserProfile_GUID Unique Identifier SID SID binary Active Directory Id ADGuid binary Account name AccountName Person First name FirstName string single value Phonetic First Name SPS-PhoneticFirstName string single value  Last name LastName string single value Phonetic Last Name SPS-PhoneticLastName string single value Name PreferredName string single value Phonetic Display Name SPS-PhoneticDisplayName string single value Title Title string single value Manager Manager Pe...

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)) ...

Why to choose SharePoint?

SharePoint is a collaboration tool which mainly used for document sharing, managing, controlling and storing them in its starting days. Sharepoint improving day by day and now its became very handy tools for the organization to work as a team. Organizations use the SharePoint as per their requirements. In Many ways, Organizations can use the SharePoint like: 1 Document Sharing and storage system. 2 It can be used as a collaboration tool. 3 As an Intranet system. SharePoint is very flexible and secure system. Its give the flexibility to develop custom solutions to fulfill the requirement. Reasons to choose SharePoint as an intranet system for your organizations. Flexibility :  SharePoint is very flexible and provide the functionality to develop and deploy custom solutions on SharePoint. one can also use the third party add-ins to fulfill their needs. Security: Sharepoint provides inbuilt security system which persists own permission levels. you can give permissi...

Shortcut keys which every windows user must know.

Shortcut keys play important role if we want to use the windows effectively. Window Key = Open or close start menu. Windows + E    =  Open the file explore.   Windows + D    = Show or hide the desktop. F11 = Minimize or Maximize the active window. Windows + S = Open search Windows + L = Lock the system . Window + R = Open the run dialog box. Windows + Tab = Open the task view. Windows + Space Bar = Switch input and language keyboard. Windows + Plus(+) = Open magnifier(To zoom in or zoom out).    Windows + A = Open Action center. Windows + T =  Move through the apps on taskbar.