Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

0

Instead of running jQuery to move columns around, you can use SharePoint Designer to create a 'new' EditForm.aspx When you create a new Edit Form from SharePoint Designer, it will give you the full HTML/ASPX of that page with the HTML for the columns on your current EditForm.aspx. Then you can copy and paste the html snippet for each question in whatever ...


3

You can get the URL of the list as below: var clientContext = SP.ClientContext.get_current(); var website = clientContext.get_web(); var list = website.get_lists().getByTitle("ListTitle"); var rootFolder = list.get_rootFolder(); clientContext.load(list); clientContext.load(rootFolder); clientContext.executeQueryAsync(function () { console.log(list....


0

Hello to work with date in SharePoint with javascript the save option is to get SharePoint site's regional time zone and convert the new Date() function according to the regional zone setting. To get Site Regional setting you refer below code. var context = SP.ClientContext.get_current(); var web = context.get_web(); var regionalSettings = web....


0

If you're building the table as a string representation of HTML, you can use SP.UI.ModaDialog to output it in a popup. Note: It may be necessary to load sp.ui.dialog.js if the page is a custom page. var tableHTML = "<table id='tblDetails'>" + "<tr><td>Project Name</td><td>" + data.d["ProjectName"] + "</td&...


0

Get Workflow status via CSOM function getWorkflowStatus(listTitle,listItemId,workflowTitle, success,error) { var context = new SP.ClientContext.get_current(); var web = context.get_web(); var list = web.get_lists().getByTitle(listTitle); var listItem = list.getItemById(listItemId); context.load(listItem); context.executeQueryAsync( ...


0

You could try to hide the whole TR by CSR, sample code for your reference. <script> (function () { var overrideCtx = {}; overrideCtx.OnPostRender = function(ctx) { var rows = ctx.ListData.Row; for (var i=0;i<rows.length;i++){ //condition //var isApproved = rows[i]["_ModerationStatus"] == "Approved"; //if (...


0

I found this code that works great for lists set to Basic Table style $(document).ready(function () { $('table.ms-listviewtable').each(function(a, tbl) { var currentTableRows = $(tbl).find('tbody tr').length; $(tbl).find('th').each(function(i) { var remove = 0; var currentTable = $(this).parents('table.ms-...


0

If the contents of roster.js is just JSON, you could try making it roster.txt and then on the receiving end: var receivedJson = JSON.parse(data);


1

this is the way I retrieve the external content type items. I define all fields i want to retrieve in the select of the rest api $select=metadata_tablaID,informacion,valor,tipo_de_dato," + "duenho,fecha_de_carga,fecha_de_vigencia,selloID,capituloID,checklistID,frameworkID,grupoID,maestroClasificadorID,nivelID


0

in this way I get the columns of the list and later, I store the columns in a variable and put it in the "select" of the next ajax, that way I dynamically create the datatable view var columnaMostrar = []; var objColumn; var columna; var colSel; function CargarListadoDeAcciones() { var siteUrl = _spPageContextInfo.siteAbsoluteUrl; ...


0

Unfortunately I don't believe that it can be loaded without a round trip to the server via JSOM or REST. One option I've used in the past is using a function on page load to populate an object by add this to the page. var PageObject = function(){ var ctx = new SP.ClientContext.get_current(), page = ctx.get_web().get_lists().getById(...


0

This would be long answer :) but I have given you code also to try it our from your side. First please note, Pages is like any other document library. You can go to Pages Library settings to view all the fields available for particular page library. Q. Also is there a list of what Page Fields exist by default? I can't find any documentation on them. ...


0

For SharePoint Online, I suggest you change the content type using PnP Powershell. #Set Variables $SiteURL = "https://tenant.sharepoint.com/sites/projects" $ListName = "Project Proposal" $OldContentTypeName = "Crescent Proposal V1" $NewContentTypeName = "Crescent Project Proposal V2" #Connect to PNP Online Connect-PnPOnline -Url $SiteURL -Credentials (Get-...


0

Did you take a look at the sample command extension found at https://github.com/SharePoint/sp-dev-fx-extensions/tree/master/samples/react-command-print ?


1

It seems that strAction doesn't get evaluated until the whole loop completes. So the easy way to do this would be to forget the loop and write four separate CAMOpt calls each with its own strAction.


0

Here is a more modern example (change get_topNavigationBar for get_quickLaunch as needed) using typescript and async/await: async addNavigationNode(title, url, parentTitle, external = true) { // Helper fn to wrap JSOM call into awaitable promise const executeQuery = async (context: SP.ClientContext) => new Promise((resolve, reject) => ...


0

Rewrote the code: function getSelectedItems(OnSuccess, OnError) { var context = SP.ClientContext.get_current(); var listId = SP.ListOperation.Selection.getSelectedList(); var selectedItemIds = SP.ListOperation.Selection.getSelectedItems(context); var list = context.get_web().get_lists().getById(listId); var listItems = []; for (idx ...


0

Try below Code: var targetList = clientContext.get_web().get_lists().getById(listId); clientContext.load(targetList); targetListItem = targetList.getItemById(values[0].id); clientContext.load(targetListItem, 'Title'); Reference: SP.List.getItemById Method


0

Use below Access control allow origin settings in web.config: <add name="Access-Control-Allow-Origin" value="http://localhost:62747" /> As the error states, you shouldn't use the wildcard. Use the application url. Edit: (Fix for Data will not come via ajax call but you can see under response in Network tab) Disable the Request Management service ...


1

You can use the code below to check if the current user is a member of a particular group, then show or hide the custom ribbon button. <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function(){ isMember("Some Group Name").done(function(){ if(data....


1

Here is a code snippet for your reference: <script type="text/javascript"> ExecuteOrDelayUntilScriptLoaded(createListItem, 'sp.js'); function createListItem() { var clientContext = new SP.ClientContext.get_current(); var oList = clientContext.get_web().get_lists().getByTitle('Test'); var itemCreateInfo = new SP....


3

The following example for your reference. 1.Create a custom list, add text field "GUID". 2.Add the code below into script editor web part in new form page. <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function (){ var fieldTitle="GUID"; $("input[...


0

Please read this article: Microsoft Flow – How to move SharePoint Online list items to folders. This is approach identical to @Lisa Chen's one, but implemented via MS Flow. (This is an option according to your question) You also may attach Remote Event Receiver (RER) to the list, or subscribe web hook. But this is not REST/JSOM/Flow Using JavaScript (REST) ...


0

You can achieve your requirement by creating SharePoint designer workflow. Create SharePoint 2010 platform workflow on the list like the following(choose start workflow automatically when an item is created): 1.create folder with same name as Title of the item. Add "Create List Item" action. select current list. Add Content type ID > select folder, ...


0

Basically the problem is that your state is can and will show only one last item. You need to change it to be able to save an array in there: export interface IRssItem{ title: string; description: string; author: string; } export interface IRssAppState{ items: IRssItem[]; } Then: showSomeXML(){ var xhttp = new XMLHttpRequest(); ...


0

your ajax call looks a bit off. $.ajax({ url: "http(s)://<URL OF SITE COLLECTION>/_api/web/lists/getbytitle('CommentBoxSource')/items", type: "POST", data: JSON.stringify(item), headers: { "Accept": "application/json;odata=verbose", "Content-Type": "application/json;odata=verbose", "X-RequestDigest": $("#__REQUESTDIGEST").val() ...


1

We can use the code below to set SharePoint background image of the pages. You need modify the holBG in code to your image url. <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> <script> $(document).ready(function(){ var holBG="/sites/lz/PublishingImages/p1.jpg"; var dtTodayHol=new Date(); ...


Top 50 recent answers are included