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

Modifying Element Values with JavaScript in Selenium using C#

As a newcomer to automation, I am facing a challenge with automating a web page that has a text field. I initially attempted using driver.FindElement(By.XPath("Xpath of elemnt").SendKeys("Value"); but unfortunately, this method did not work. I then resor ...

Error encountered during sequelize synchronization: SQL syntax issue detected near the specified number

Four Sequelize Models were created using sequelize.define();. Each model is similar but with different table names. To avoid manual creation of tables in MySQL cli, the decision was made to use sequelize.sync() in the main index.js file to allow Sequelize ...

Retrieve the most recent version of the document stored in MongoDB

Is there a way to retrieve the _id (the Mongo ObjectID) of an updated document without having to find it by newData/oldData? I attempted the following: ... collection.update(oldData, newData, function(err, doc) { console.log(docs); // This prints "1" ...

Is there a way to determine the duration that a click was held down for?

When triggering an onClick event, I want to determine whether it was a single click or if the mouse button was held down for some time before releasing. This way, I can call the myTest() function within onClick="myTest()", which will log "mouse was click ...

Server nearby designated to handle requests to the api

Currently, I am working on a project involving automation. Within Adobe CEP, there is a local server that operates on Node.js/Express. My goal is to send an API request from a cloud server to this local server. How can I establish a connection between my l ...

What methods can I use to ensure the headline remains fixed like the table headers?

I am currently working on creating sticky table headers. Below is an example showcasing my progress and what I am aiming to accomplish. Below is the script I discovered from another source. function makeTableHeadersSticky(tableId) { var thArr = $(tableId ...

Make sure to incorporate certain node_modules folders within Babel 7

My issue involves a dependency located in the node_modules directory that requires compilation through Babel. Despite upgrading my stack, I am unable to get Babel to compile the dependency. Current versions: @babel/core 7.5.4 webpack 2.7.0 Here is my w ...

Issue encountered: Unable to fetch username and password from request

Currently, I am developing a login and registration system. However, when I input the correct details in my register Post method, the request remains pending and I cannot identify the error. The specific error message it presents is data and salt arguments ...

Deactivate a span in real-time using ng-model

I found a helpful guide on creating a custom editable <span> using ngModelController here: https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#example Now, I am looking to implement a feature that allows me to dynamically disable editin ...

Looking to showcase initial API data upon page load without requiring any user input?

Introduction Currently, I am retrieving data from the openweatherAPI, which is being displayed in both the console and on the page. Issue My problem lies in not being able to showcase the default data on the frontend immediately upon the page's fir ...

Creating a REST API with user-specific authorization: A step-by-step guide

Currently, I am in the process of developing a REST API backend server for my web application using NodeJS, ExpressJS, and MySQL as the database. My main concern lies in implementing authorization to prevent User A from accessing or modifying another user& ...

Tips for continuing to write to the same CSV file without starting over

Currently, I am utilizing a nodejs package to write data to a CSV file every minute. The initial creation of the file and the first write operation work fine. However, when attempting to write to the same file again, I encounter an error in nodejs. Despite ...

Having trouble with the toggle button on the Bootstrap 5 navbar?

I am facing an issue with my HTML code where the toggle button does not display properly when I resize the browser screen. Upon clicking on it, the navigation bar items do not show at all. Here is a screenshot of my website <html> <head> ...

Model Abstracted Aurelia Validation

I recently completed an online course on Aurelia by Scott Allen where he introduced the Aurelia-Validation plugin for form validation. As a result, my view-model now looks like this in edit.js: import {inject} from "aurelia-framework"; import {MovieServi ...

Choose an image depending on the title, but only if a specific condition is met

var no_images2 = $j("img[title^='Click to enlarge image no_photo']").parent(); $j(no_images2).css('pointer-events','none'); var no_images3 = $j("img[title^='Click to enlarge image no_photo']").parent(); $j(no_images ...

Collapse the Bootstrap Menu upon selecting a Link

I am working on a side menu with an offcanvas display feature. The current functionality is such that when the button is clicked, the canvas pushes left and opens the menu. However, I want the menu to collapse and close automatically when a link is selecte ...

Changing innerHTML with HTML generated by a PHP function? (utilizing xajax)

I have managed to successfully update the content inside a DIV using xajax when clicking a link. However, I noticed that it only works when I directly assign HTML within the function itself, not when calling it from another function. Allow me to demonstra ...

All menus effortlessly sliding out simultaneously

I'm having an issue with my navigation bar. I want each link to slide its corresponding DIV up or down when clicked. However, all the DIVs are sliding and when clicking on the same link everything slides up. How can I fix this problem? This is my HT ...

Error in React Router when using TypeScript

Encountering errors while trying to set up router with React and TypeScript. https://i.sstatic.net/muSZU.png I have already attempted to install npm install @types/history However, the issue persists. Your assistance would be greatly appreciated. Thank y ...

Pass numerous data elements using .ajax() to be processed in a PHP script

Currently, I am encountering difficulties while attempting to send two distinct groups of information through .ajax() to a PHP script for processing. The scenario is as follows: when a user enters a page, 1) a timer begins counting seconds and 2) the user ...