Discovering Unconventional Columns Through Sharepoint REST Api Filtration

I am working on recreating SharePoint's front end in my app and want to add columns to my table just like a user would in SP. The challenge I am facing is determining which columns were custom generated by the user rather than standard ones.

Although I can retrieve properties for list items/files and identify user-generated columns in the response, I am seeking a way to filter specifically for non-standard columns only.

User Generated Column in SP

https://i.stack.imgur.com/m9uVj.jpg

Column in Results (along with all default fields)

https://i.stack.imgur.com/HmB2n.jpg

Answer №1

To retrieve custom fields from a specific list, you can utilize the following REST API:

http://sp2013/_api/web/lists/getbytitle('CustomList')/fields?$select=Title&$filter=FromBaseType eq false

If you are working with a document library, you can use the following API endpoint:

http://sp2013/sites/team/_api/web/lists/getbytitle('Documents')/fields?$select=Title&$filter=FromBaseType eq false and Hidden eq false and CanBeDeleted eq true and substringof('SourceID="{',SchemaXml)

Answer №2

The best way to differentiate between a built-in field and a custom one is by using the SPField.SourceId Property:

This property retrieves the namespace for built-in fields or, if it is a custom field, the GUID of the list or Web site where it originates from.

In the case of SharePoint REST API, although the SourceId property is not directly available, it can be extracted from the SchemaXml property.

An example below illustrates how to fetch all custom fields from a list:

https://site.sharepoint.com/_api/web/lists/getbytitle('<list title>')/fields?$select=InternalName&$filter=substringof('http://schemas.microsoft.com/sharepoint/v3',SchemaXml) eq false

After retrieving the list of fields, you can gather values of list items by specifying the field names in the $select expression:

https://site.sharepoint.com/_api/web/lists/getbytitle('<list title>')/items?$select=<fieldname1>,<fieldname2>

Update

If you encounter the error message

"Cannot find resource for the request fields"

this indicates that the requested resource (in this case, a library) could not be located. Ensure to provide the library title when using the getbytitle method:

https://site.sharepoint.com/_api/web/lists/getbytitle('<list title>')

                                                      ^^^^^^^^^^^^^^  

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discovering the value of an item when the editItem function is triggered in jsGrid

Within my jsGrid setup, I have invoked the editItem function in this manner: editItem: function(item) { var $row = this.rowByItem(item); if ($row.length) { console.log('$row: '+JSON ...

What is the best method for comparing two JSON objects in AngularJS?

I am working with two JSON objects. $scope.car1={"Sedan":{"Audi":["A4","A3"]},"Hatchback":{"Maruthi":["Swift"]}}; $scope.car2={"Hatchback":{"Maruthi":["Swift"]},"Sedan":{"Audi":["A3","A4"]}}; I have attempted to compare these two objects using the co ...

Utilizing and transmitting contextual information to the tooltip component in ngx-bootstrap

I am currently working on integrating tooltips in ngx-bootstrap and trying to figure out how to pass data to the ng-template within the tooltip. The documentation mentions using [tooltipContext], but it doesn't seem to be functioning as expected. Belo ...

Steps for dynamically loading the content of a Bootstrap 4 Modal

I am currently in the process of developing a website that will showcase a wide range of images. The design is set up as a landing page with all content contained within the main HTML page - there is only an index.html file for now. This website will serv ...

The format provided is not utilized by Datetimepicker

I've encountered an issue with the Date Time Picker provided by JQuery. Despite setting a specific format, it seems to be using its default date format which results in the following error appearing in the console: Uncaught TypeError: F.mask.replace i ...

What is the best way to verify the presence of a file using jQuery?

I am using "tinyMCE" dynamically on a single page. To modify the content in "tinyMCE", I have to use the "setContent" function. However, I am unsure how to check for the existence of a file (using PHP's is_file function) either within ajax or before ...

Navigating through a mergeMap observable with an undefined value

In my Angular 6 app, I have a class that attaches API tokens to every http request using the getIdToken() method. If the token retrieval is successful, everything works fine. However, if it fails, my app will stop functioning. I need help with handling th ...

What is the best way to create a scrollable tbody in an HTML table using React?

In my current project, I am using React, Node, Express, and Postgres to fetch data from a database. The issue I'm facing involves creating a scrollable table within a div that spans the entire screen width. Initially, I had to apply display: block to ...

Dividing internal CRUD/admin panel from the live application

Currently developing a moderately complex react app with redux. We have a production version that meets our requirements and now we are working on an administrative area for a local version of the application. This local version will only have basic CRUD f ...

Generate a dynamic vertical line that glides smoothly over the webpage, gradually shifting from one end to the other within a set duration using javascript

I have designed a calendar timeline using html. My goal is to implement a vertical line that moves from left to right as time progresses, overlaying all other html elements. This functionality is similar to Google Calendar's way of indicating the curr ...

Tips for utilizing Vue.js techniques to assign values to data properties

As a newcomer to Vue.js, I am in the process of learning how to display data retrieved from a server. In my new Vue app, I have defined a method: methods: { getData: function() { // making a request, parsing the response and pushing it to the array. ...

Using localStorage in the client side of nextJS is a breeze

Encountering an error while attempting to retrieve local storage data. Even with the use client directive in place at the beginning, the issue persists. 'use client'; const baseURL = 'https://localhost:7264'; const accessToken = localSt ...

Having trouble with the parent folder functionality in JavaScript?

I am facing a challenge with my website's structure as I have an old setup that needs to be updated. http://localhost/enc/pdfs/ : This directory contains some html files that are uploaded via ajax to be displayed on a tabbed div using: var Tabs ...

What steps can I take to resolve the TypeError in next js where I am unable to set properties of undefined for 'className'?

I've been working on a Next.js project and I've copied some code from CodePen that is used for designing product layouts on an e-commerce website. However, I'm encountering a problem with the following error message: TypeError: Cannot set pr ...

Tips for turning on a gaming controller before using it

Current Situation In my ionic side menu app, I have a main controller called 'main view'. Each tab in the app has its own controller, which is a child of the main controller. The issue I'm facing is that when I start the app, the first cont ...

What is the best approach to integrate a JQuery-powered widget into a Vue.js module for seamless use?

I have a group of colleagues who have started developing a complex web application using Vue.js. They are interested in incorporating some custom widgets I created with JQuery in the past, as re-creating them would be time-consuming and challenging. While ...

Use jQuery Ajax to fetch an image and display it on the webpage

Currently, I am working on an application that is designed to browse through a large collection of images. The initial phase of the project involved sorting, filtering, and loading the correct images, as well as separating them into different pages for imp ...

Creating dynamic input fields in JavaScript by using class-based methods

I have a requirement to dynamically duplicate a couple of fields whenever the user clicks on the Add button and then capture the data from these fields. While searching online, I came across various tutorials like Tutorial which demonstrate how to create n ...

Validation in JQuery Mobile is crucial for ensuring that user input is correct before submitting a

Trying to create a login page using JQuery Mobile, I implemented validation with the jQuery validation plugin and AJAX to post the data to a PHP server code if validation is successful. However, instead of functioning as intended, the code redirects back t ...

Issue: The initial parameter should be a File or Blob object

Hey there! I'm currently utilizing the compressorjs plugin for compressing images, but I'm encountering an issue when selecting images. You can find out more about the plugin here. Here is my code snippet: window.resolveLocalFileSystemURL( ...