New answers tagged

0

Maybe instead of using JavaScript, you can just change the Date picker's format to use Hijra? I am borrowing the answer from Wael. To do that, follow these steps: Add a date picker control… Right click the control and click properties… In the display tab, click on format Make sure that the locale is the locale is you want. For Arabic or Islamic choose "...


0

There are at least three ways to create SPA in SharePoint Online: Provider hosted app (Useful if you have server-side logic) SPA SPFX webpart (Not a very good option as of August 2019), but will iprove later on Custom SPA solution using HTML + CSS + JavaScript Let's talk about Approach #3: Custom SPA solution using HTML + CSS + JavaScript Steps Create ...


0

The Answer above is correct. In case you wonder ,how to do it with more than one Property except "Id": You don't need this if you don't specify which Properties to include in the Load, then all will be returned, but if you want to save bandwith, you might want to specify only the necessary properties. Here my Example Code: (Trying to fetch all Documents ...


0

You're almost there... a couple things to note: If you see the CAMLViewFields part of the SPServices code, you'll see that you only really need to retrieve two fields, Title and RequiredField. That can translate into a $select in your REST query. You probably need to specify the URL of the site you are trying to query against, so you could add ...


2

By Looking at your code, Either jQuery is not loaded properly or your selector for currency is wrong: Try below code: Using Plain JavaScript: var currencyField = document.querySelector("input[title^='Currency']"); //Here "Currency" is display name of field. var currencyValue = currencyField.value; currencyField.addEventListener('change', ...


0

Funny I was just using that code for some other issues today. I haven't tried to use it in a folder, but I think I know what the issue is. The call to OpenEditFormForLastItem() constructs a CAML query to find the information about the uploaded documents and creats something like this: <View> <Query> <Where> <Eq&...


0

Yes, It is possible to fetch the 1000 items using $top. Use something like below: https://domain/sites/site/_api/web/lists/getbytitle('example')/items?$select=Email/EMail&$expand=Email&$top=1000 Also, I noticed in URL, you have used: /lists/getbytitle%example%/ Is it working correctly? If Not, it should be like : /lists/getbytitle('example')...


1

While JSOM is still indeed supported, Microsoft is not working actively on JSOM and is pushing new change via RESTful endpoints. The ability to fetch property bag value is supported via REST API. You can do that as below for your code using jQuery, but you can use any other library that your prefer : $.ajax({ url: _spPageContextInfo.webAbsoluteUrl +...


0

You can get web property bag using JavaScript object model. But make sure SP.js file is loaded first on your SharePoint page. Try using below Code: //wait until client object model dependencies are loaded before executing our code ExecuteOrDelayUntilScriptLoaded(getWebProperties, "sp.js"); var webProperties; function getWebProperties() { var ...


0

In your code there is a syntax error. In $(document).ready() the bracket { is missing. You can put your code inside this: $(document).ready(function() { //Your code goes here });


0

For SharePoint Online and SharePoint 2016/2019 $batch Rest API is supported. However, $batch REST API supported but implementation is very tricky, and there is very limited resource available online. Recently I have found an easy way to implement $batch API using a few lines of code using BatchUtils.ts. See below code snippet for CRUD Operation using $batch ...


0

So here is the answer. The variable needs to be told to look for an array of possible answers, not just one. The code looks like this: var ProjectPhase = document.querySelector("table[summary='Project Info Log ']").innerText.match(/(Pending|Active|On Hold|Cancelled)/)[0]


1

Assuming display name of your choice field is "Project Status" and it is drop-down, you can try something like given below: <script type="text/javascript"> var ProjectStatus = document.querySelector("select[title^='Project Status']").value; switch(ProjectStatus) { case "Pending": document.getElementById("...


0

You have set the JS ID(Client ID in JavaScript variable) for the dropdown and textbox field, then use the code like below to achieve it. NWF$(document).ready(function(){ NWF$('#' + JSID1).change(function(){ var selection = NWF$('#'+JSID1); NWF$('#' + JSID2).val(selection.val()); }); }); The following articles for your reference. ...


0

You can use the second list view web part to filter the first web part via list web part connection. There is a blog about this similar topic for your reference: Creating Connected Web parts in SharePoint


1

You would not not be able to do it using any OOTB solution, customization would be required. Here is high level approach. Create a Page, get data from SharePoint List using JSOM/REST API. Display data using Custom html or use jquery data table. Loop through each item to create custom json object. While looping through add two attribute to json 1. Status and ...


0

The following code for your reference,add the code into a script editor web part in site page. <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { var projectPhase=$("table[summary='Project Info Log']").text(); if(projectPhase.indexOf("Phase 1")!...


1

Sample JavaScript that could work for you... (i.e. code written over lunch break from memory and not fully tested :-) ) This returns null if there are no items, otherwise a collection of matched extensions. (not the full file names) document.getElementById("idAttachmentsTable").innerText.match("\.xltm|\.xlsm") The regular expression ("match"): The dot ...


1

A few things to check... The web part is still #6 on the page. ("MSOZoneCell_WebPartWPQ6") What happens if you type "document.getElementById("MSOZoneCell_WebPartWPQ6").style.display = 'none'" into the browser's Console? The Summary text contains more than the text you are testing for. Extra spaces, the list's title, etc. summary='Project Info Log' ...


0

I doubt that you can easily prevent the upload of these files as the upload is triggered from a button click and completed within the upload code/dialog. You can check after the upload and then prevent the saving of the item. If you are using the Classic UI New Item form... Attachments are listed at the bottom of the form in an HTML table with the ID "...


1

Instead of document.getElementById('Email_a6570af6-8b72-4ab0-814d-93f50f26e185_$TextField').innerHTML = userInfoItemE; try document.getElementById('Email_a6570af6-8b72-4ab0-814d-93f50f26e185_$TextField').value= userInfoItemE; Explanation innerHTML is supposed to manage the child HTML elements. In your case, it procudes invalid HTML. < input > is ...


1

Unfortunately, you cannot update a list view with the help of user API without refreshing the whole page. But it is possible to extract corresponding method from a built-in require module with the below code: var listEl = document.querySelector('.sp-App-root'); var listVM = __ko.dataFor(listEl); var ii = listVM.resources.consume(require.s.contexts._.defined....


0

Considering @currentField in your second JSON is the value of Review Status as you need. Try using below JSON Code: If you want colored Text: { "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "style": { "text-align": "center", "vertical-align": "middle", "...


1

Modify the JSON formatting as below. { "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "=if([$Review_x0020_Status] == '', @currentField, '• '+@currentField)", "style": { "color": "=if([$Review_x0020_Status] == 'Not Due', 'green', if([$Review_x0020_Status] ...


4

You can pass the display name of your SharePoint List in REST API call like below: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('abc list')/items" Also make sure you are passing correct ListItemEntityTypeFullName in type property inside __metadata. You can check ListItemEntityTypeFullName of your list using below URL: /_api/web/lists/...


1

We can use the REST API to get UserId of all the users in the people picker field, then pass field data as below to add item using REST API. "RequestorId": { "results": userIds} The following example code for your reference. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script type="text/...


0

If you would like use REST api then I'll advise you to go with Sagar's solution. Here are few alternative also, Using Jquery services. (Ref from Atish) ExecuteOrDelayUntilScriptLoaded(getListId, "sp.js"); var list; function getListId() { var context = new SP.ClientContext.get_current(); var web = context.get_web(); list = web.get_lists().getByTitle('Name ...


0

You can make a simple REST api call to get GUID of the libarary. All you have to do is extract library name from the URL given by user in Step 1 and pass it to the REST call as shown below: _api/web/lists/getbytitle('YourLibraryName')?$select=Id


0

I am not sure if it is doable with promoted-links web part. The workaround i can think of is using the search result web part. You can use certain rules to show only wanted document libraries with KQL. A sample query only returns document libraries in a site. Add more rules to limit. path:"https://yoursite.sharepoint.com/sites/sitename/" contentclass:...


0

Maybe I am just ignorant, but why not just change the Time Slot Date column to only be a Date Field and not a Date and Time field? Maybe try this if you must use jQuery: $("select[id*='Time']").hide(); If that wont work - you may have better luck by putting the script in a .html file and store it on the site and refer to it with a content editor web part. ...


0

Refer below code: This is example to disable first value(0th position) in dropdown. Here "DT" in the jQuery selector($("input[title='DT']")) is the "title" of DateTime field. (Update this with the title of you field). No Need to update anything else. It should work. var tdTimeSection = $("input[title='DT']").closest("td").siblings(".ms-dttimeinput"); $(...


0

Try something like this: <script> $(document).ready(function() { $("select[id$='DateTimeFieldDateMinutes']").children("option[value='00']").hide(); }); </script> Here $ shows that ID of select Ends With specified value DateTimeFieldDateMinutes. Also, you can add completed ID for drop-down selector(Add selector carefully to get ...


0

Try something like below: <script> $(document).ready(function() { $("#selectId").children("option[value='00']").hide(); }); </script> Where #selectID will be ID of your select control (Add selector carefully to get the particular element only). Update: For your case try this: $("#Time_x0020_Slot_x0020_Date_b6585aee-0ec0-4964-...


0

I doubt you want to implement SPO authentication, file transfer, unzip, OOXML parsing yourself, so here's how you'd do it with existing libraries. Read file using PNP JS: https://pnp.github.io/pnpjs/sp/docs/files/ sp.web.getFileByServerRelativeUrl("/sites/dev/documents/file.xlsx").getBuffer().then((buffer: ArrayBuffer) => { // parse Excel here }); ...


0

In your success function, you can try something like below: function Success() { var listEnumerator = collList.getEnumerator(); while (listEnumerator.moveNext()) { var oList = listEnumerator.get_current(); var startDate = oList.get_item('DateTimeColumnName'); // 'DateTimeColumnName' is internal name of date field } } You can ...


1

Modify the renderTrafficLight method as below. function renderTrafficLight(ctx) { var curritem = ctx.CurrentItem; var dueDateValue = ctx.CurrentItem['DueDate']; var trafficLightValue = ctx.CurrentItem['Traffic_x0020_Light']; var actualStartDate= ctx.CurrentItem['Actual_x0020_Start_x0020_Date']; var returnValue; if(actualStartDate!="")...


1

Even collListItem contains one item only, it's a collection https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj245102(v=office.15). So iterate the collection to get the first one. var collListItem; function QueryLastNewItem() { var clientContext = new SP.ClientContext(); var List = clientContext.get_web().get_lists()....


0

You should first convert string to Int using parseInt function. Below is your modified code. var collListItem; function QueryLastNewItem() { var clientContext = new SP.ClientContext(); var List = clientContext.get_web().get_lists().getByTitle('Tracker'); var query = new SP.CamlQuery(); query.set_viewXml("<View><RowLimit>1</...


0

I removed the step of getting the item's ID since I can pull what I need from that item once it's loaded without having the ID, I also changed the format of the query (if writing it as multi-line each line needs to be in quotes with a "+" on the end. I also inserted the query directly into query.set_viewXml() rather than creating a variable for it. Now it's ...


1

Try using below query on Status field: <Where> <Eq> <FieldRef Name='Status' /> <Value Type='Choice'>New</Value> </Eq> </Where> Note: Assuming that Status field is a Choice field. I would recommend you to utilize the tool that will help you build your CAML Queries easily, for example U2U Caml Query ...


Top 50 recent answers are included