A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

New answers tagged

1

Use SP.SOD.executeFunc('clientpeoplepicker.js', 'SPClientPeoplePicker', function () { var neededPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[GiveTheIndexHere]; var usrObj = { 'Key': 'i:0#.w|domain\user' }; neededPeoplePicker.AddUnresolvedUser(usrObj, true); }) Adding my complete code below. The requirement was to auto-populate ...


0

Embrace the content type which contains space within double quotes like "News Page Channel". http://mysite/_api/search/query?querytext='contenttype:"News Page Channel":Corporate'&rowlimit=1 This worked for me. I hope it works for you also. Note: Any parameter with space in search query should be embraced with double quotes( " ).


1

This is really more of a general JavaScript question than SharePoint-specific, but the easiest way is just to use an array variable: var itemprices = []; and then push the values as you find them itemprices.push(oListItem.get_item('Price'));, and then you can loop through your array when you want to do something with each Price. Alternatively, you could use ...


1

<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>{PUT YOUR LOOKUP ITEM ID HERE WITHOUT THESE CURLY BRACES}</Value></Eq></Where></Query></View>


1

Try using below code: //Display name of your field var fAssignedTo = "Assigned To"; $(document).ready(function(){ BindPeoplePickerWithLoggedinUser(fAssignedTo); }); function BindPeoplePickerWithLoggedinUser(ppTitle){ setTimeout(function(){ var _PeoplePicker = $("div[title='" + ppTitle + "']"); var peoplePickerEditor = ...


1

Use the below lines of code: dateT =new Date(date.getFullYear(),month, day) ; var posDeliveryDate = dateT; oListItem.set_item('DeliveryDate', posDeliveryDate); Now the dateT will be in the correct format to be inserted into SharePoint list. For more information, refer below link: Updating a list item using date() function.


0

BTW I must say that there is a problem with SP.Base64EncodedByteArray converting the chars from Unicode to ASCII (or something like that) After some research, I found out that when fileContent.charCodeAt(i) returns a number that is bigger than 255, (which in binary code the number is made with more than two bits), SP.Base64EncodedByteArray will not refer to ...


1

You will find that pretty much all bugs are logical mistakes. :) You say you have the following lines of code in your onFormLoad() function, which runs when the the page loads: // this line attaches your onChangeEquipment function // as the change handler for the radio buttons control NWF$("#" + varCataloguePicker).change(onChangeEquipment); // this line ...


0

A solution that works for sure, but which I don't like, is to hijack the render function of the suite bar. See below. Ideally, there should be a callback function provided by SharePoint that allows us to run JS code after the suite bar has finished rendering, but there is none of that AFAIK. SP.SOD.executeFunc('suitenav.js', '_o365sg2c.O365Shell....


1

The SharePoint REST API has a little... I don't know what to call it - extension method? - anyway, an endpoint called FieldValuesAsText which will give you what you want. I haven't used it too much, but from just now playing around with it a bit in Postman, it seems like in order for it to work properly, you will need to know the ID of the list item you are ...


1

Try using your code something like below: var oListItems; function GetAllListItems() { // You can optionally specify the Site URL here to get the context // If you don't specify the URL, the method will get the context of the current site // var clientContext = new SP.ClientContext("http://MyServer/sites/SiteCollection"); clientContext = ...


2

The problem is the value you have in this variable accResponsible. User field in SharePoint list cannot be update using a var value, we need a SP.FieldUserValue to put it into the list. I find answer here using the person name instead the id is more easy than find user id if you don't have it. How to set any SP.Field Value with JSOM (Javascript) in ...


2

While using JSOM we need to use the internal name (and not the display name of column which you see in the list) of the SharePoint column in code. By looking at an error you are getting I suspect that you are using the wrong name of your PosType field. Check the internal name of your column by using the method given in below article and then use that name ...


1

Modify the code as below. function getUserInfo(peoplePickerElementId) { try{ var toSpanKey = peoplePickerElementId+ "_TopSpan"; var peoplePicker = null; var ClientPickerDict = this.SPClientPeoplePicker.SPClientPeoplePickerDict; for (var propertyName in ClientPickerDict) { if (propertyName == ...


0

instead of $(document).ready() function, declare a variable above to it. Example: var txtAppArchitectId = ""; $(document).ready(function(){ //Do your stuff }); function getUserInfo(peoplePickerElementId) { try{ var toSpanKey = peoplePickerElementId+ "_TopSpan"; var peoplePicker = null; var ClientPickerDict = this....


0

I solved my issue by creating componentDidUpdate method with parameter interface of weather and checking old and new value if value mismatch then I will call getWeather and getLocation which will re-render component with new value. public componentDidUpdate(prevProps: IWeatherProps, prevState: IWeatherStates) { let _units = this.props.units ? 'us' : '...


0

As @Unnie inform that you have enable cross on server and if api server is not in your control then you cannot do it. for that you have to create proxy server who will take care CROS There several options from that I will tell you two If You can use azure then use azure function where you can make api proxy and do setting for CROS Use https://cors-...


0

You could use jslink/csr to customize the form as tabs. <script> var currentFormUniqueId; var currentFormWebPartId; // Use "Multi String" javascript to embed the required css var MultiString = function (f) { return f.toString().split('\n').slice(1, -1).join('\n'); } var tabsStyle = MultiString(function () {/** .tabs { border-bottom: 1px solid #...


0

I did it! By using folder.get_files().add(fileCreateInfo) I was able to get to any specific url and update any file! The code: updateFileBtn.onclick = function(){ var urlParts = urlInput.value.split("/"); //in my particular case, I use an HTML input object to update a file in a specific url. Also the var 'data' is the new data I'm about to write to ...


1

First, as mentioned in the comments above, you should not assume that ID of the first item is 1, you need a more predictable way to get your item. Second, the set_item method should be called from the variable that holds the reference to the item you retrieved. You code calls listItem.set_Item, but listItem is not a defined object. Finally, the attempt to ...


0

We can locate or upload the file in inside sub folder using the below REST API code: <script src="http://code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script> <script type="text/javascript"> //Function attached to the html fileupload tag (<input type="file">) function uploadFile(){ if (document.getElementById("...


0

Here is a JS code demo for your reference: <script src="http://code.jquery.com/jquery-1.12.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function(){ var fieldName="MultipleText"; var defaultText = " "; $('nobr:contains(' + fieldName + ')').closest('tr').find('input[id$="TextField_spSave"]').val(...


0

According to SharePoint: How to close a Modal Dialog Window, under "Methods to close Modal Dialog Window" it states (emphasis mine)... To close a Modal Dialog Window we can employ the methods shown below. Note that the methods become accessible through the window.frameElement after the dialog has been opened/created, in other words, SP Dialog framework ...


1

Sadly I think that is the way it is headed. According to this article, the June 2017 update for SP 2013 and 2016 included a switch called CustomMarkupInCalculatedFieldDisabled. It allowed your administrator to choose if HTML would show up for calculated fields. I can't find complete documentation, but searches seem to suggest that the switch is no longer ...


1

No need to use the JS code to hide the All Day Event column. Follow below steps to achieve this: Go to List Settings. Enable Allow management of content types to Yes - Check the steps here. Under Content Types section, select Event. Click on Title column. URL will be something like: https://tenant.sharepoint.com/sites/sitename/_layouts/15/...


0

Tested script in my online environment, insert script editor webpart into the edit form and insert below script into it. <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script> <script type="text/javascript"> SP.SOD.executeFunc('clientpeoplepicker.js', 'SPClientPeoplePicker', function () { ...


0

You can remove it using JS after loading "clienttemplates.js": var peoplePicketEditor = $('[id^="' + fieldName + '"][id$="ClientPeoplePicker"]'); var spPeoplePicket = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePicketEditor[0].id]; spPeoplePicket.DeleteProcessedUser(); to delay execution use: ExecuteOrDelayUntilScriptLoaded(youFunction, '...


0

Try using below CSS to hide the "New Item" button from your page: #Ribbon\.ListItem\.New\.NewListItem-Large { display: none !important; }


1

Add CSS below to script editor web part: <style> span[id='Ribbon.ListItem.New.NewListItem-Large'] { display: none; } </style>


0

Just add the script editor webpart on the page and add the below code to it, <script type="text/javascript"> var elem = document.getElementById("Ribbon.ListItem.New.NewListItem-Large"); elem.style.display = "none"; </script>


3

You could use react-slick slider. Sample test demo in my SPFx: You could customize the Previous Next as image instead of text. Update: The library supports custom HTML. Update part2: My test component(many test scenarios, ignore others) import * as React from 'react'; import styles from './ReactSpFx.module.scss'; import { IReactSpFxProps } from './...


2

As per my understanding adding dots is not possible as of now (correct me if I am wrong). However, you can add style to your previous and next button using prevButtonStyles and nextButtonStyles as given in documentation. Or as a work around you can use React Carousel control: Carousels.


0

The following example code for your reference. <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> <script type="text/javascript"> function createListItem() { var listTitle="CL1224"; var item = { "__metadata": { "type": "SP.Data."+listTitle+"ListItem" }, "Title":"MyTest", ...


1

Just as teylyn said, SharePoint does not support a hierarchical tree for permission groups. You can add folders to build a similar hierarchy while I think you will need to create unique permissions in each level. Or you can consider creating separate lists with different groups. M1 is a site level manager while M2 and M3 only has permission on certain list....


Top 50 recent answers are included