The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

Sample test demo( not sure the requirement why you get item id from iframe url). <iframe id="MyIFrame" style="display:none" src="/Lists/MyList/DispForm.aspx?ID=1"></iframe> <span id="Sig"></span> <script type="text/javascript"> var itemId ; var targetListItem; ExecuteOrDelayUntilScriptLoaded(...


0

Can't you use jQuery $(document).ready() Method? I've used in similar situation to retrieve context's user role to show/hide certain sections of the page. Here is a jQuery Code Snippet; was added using SharePoint Designer. <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server"> <script type="text/javascript" src="../../...


0

You're not doing it right. It should be: <script> $('form').on('submit', function(e) { e.preventDefault(); var title = $("#Title").val(); $SP().list("MyName").update({Title:title},{ where:"ID in ['34', '45', '55', '33']" }); }); </script> It means that for items with ID #34, #45, #55 and #33, the column 'Title' will be ...


0

There are many training courses available in pluralsight, lynda.com and udemy.com. Pluralsight has large volume of course for different types of users like Beginner, Intermediate and Advanced. I think you can first start with Pluralsight.


0

My guess is you have some of the internal names of the fields wrong. Clearly Title, which you have as items[i].Title and sourceType, which you have as items[i].w01u are returning the correct values. Which makes me think that if all the rest are undefined, it's because those properties, at least as you have them listed in your code, do not actually exist on ...


0

Your for syntax is not correct: for (var i = 0; i "; var deleteprojinput = ""; While not undefined, your fullResults string concatenation is strange as there are no delimiters between all of the string values. It generates this: 'Titlesource TypefactorIDpollutantNamepollutantEFValuepollutantEFUnitsboilerUnitIDEDIT BUTTONDELETE BUTTON' Lists have ...


0

I just did an alert to show what the empty list item was showing. It showed null. SO I i changed it to if (whatever("whatever")==="" || whatever("whatever")=null)... it now shows what I want to show.


0

If you want to add user to Azure AD, we need use Graph API to achieve it. Graph API: https://graph.microsoft.com/v1.0/users If you want to use JavaScript code, we can using Microsoft Graph JavaScript Client Library.


0

If you're using modern UI, you should either customize a form with PowerApps or use another designer of forms, e.g. Plumsail Forms. There're no other ways to run custom code in a SharePoint form.


0

External users have to be invited to a SharePoint Online site, there is not a registration option.


0

Plain Text Multiple field: Get $("textarea[title='Description']").val(); Set $("textarea[title='Description']").val("test");


1

Get multi-line Text field value : $("textarea[id^='Description']")[0].innerHTML; Set multi-line Text field value : $("textarea[id^='Description']")[0].innerHTML = "Your text"; I hope this helps !!!


1

Add json formatting with the following code { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "debugMode": true, "txtContent": "=if([$Date] > @now, 'Yes', 'No')", "style": { "background-color": "=if([$Date] > @now, '#ff0000', '')" } } Click on the down arrow of behind ...


0

i solve that problem. It has to be raw ! here my codes ; function convertDataURIToBinary(dataURI) { var BASE64_MARKER = ";base64,"; var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length; var base64 = dataURI.substring(base64Index); var raw = window.atob(base64); return raw;}


0

As Trevor's suggestion, if want to use C# code in SharePoint Add-in, it's necessary to use Provider Hosted Add-in Type rather than SharePoint hosted Add-in (which is build with total client side code, html/javascript), for creating Provider Hosted Add-in, please refer the following demo: Provider Hosted App in SharePoint Online using Visual Studio 2017 + ...


0

I can see there are some syntax errors in your code like: dateToString1 is not defined anywhere. Arguments/Parameters you are passing and using in date_diff_indays() function are different. Check below question on Stack Overflow to get the number of days between two dates: How do I get the number of days between two dates in JavaScript?


0

Content inside a <div class='html-content'>....</div> can be downloaded as pdf with styles using jspdf & html2canvas. You need to refer both js libraries, <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js"></script> <script type="text/javascript" src="https://html2canvas....


0

Sample test demo: using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace TestWeb.WebControls { [DefaultProperty("Text")] [ToolboxData("<{0}:WebCustomC runat=server></{0}:...


0

You may have better luck using the Graph for this. Create a REST request in the contaxt of the user. https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0 /me/photo/$value or if it's for another user /users/{id | userPrincipalName}/photo/$value


0

Test if images are present in SharePoint by using the below urls: https://my-site-url/User Photos/Profile Pictures/david_contoso_onmicrosoft_com_MThumb.jpg https://xxx.sharepoint.com/sites/dev/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='PictureURL')?@v='i:0%23.f|membership|user@xxx.onmicrosoft.com' If still it ...


0

You need to use something like: $("#myDiv input").prop("disabled", true); $("#myDiv select").prop("disabled", true); $("#myDiv textarea").prop("disabled", true); I tried below and it's working: <div id='myDiv'> <tr> <td>Input1</td> <td><input type="text"/></td> </tr> <tr> ...


0

Just copy - paste and run . You dont need import everything library :D Best performance solution :) function populateDataFields() { var data = {}; $.ajax({ url: _spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties", headers: { Accept: "application/json;odata=verbose" }, ...


2

You can use the below code or use third-party js like moment to format dates. function GetKPIS(EstruturaKPI){ jQuery.ajax({ url: "SITE/_api/web/lists/GetByTitle('KPI')/items?$filter=Title eq '" + EstruturaKPI + "'", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: ...


0

Thanks Aris for your sharing, I have the same issue a few months ago, I put the window.location.href just in the render function, it won't redirect and finnally, I also change the isDomainIsolated to false and it solve the issue.


0

For such scenario's you can use Client Side Rendering in SharePoint. https://www.codeproject.com/Articles/620110/SharePoint-Client-Side-Rendering-List-Views


0

Try to use the code below to check if it works. Edit the modern page and add the code into modern script editor web part and click "Republish", and "Ctrl+F5" to refresh the page. <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> <script type="text/javascript"> var jq = $.noConflict(); jq(document)....


0

Finally, it works, I changed from true to false: on config/package-solution.json -> "isDomainIsolated": false.


0

If your redirection URL is not dynamic then you can create a button like below: <button type="button" onclick="parent.location='<redirection url>'">Click Here</button> Or <button type="button" onclick="location.href='<redirection url>';">Click Here</button> You can find more answer in below link: How to create an HTML ...


0

Try Using below code: <div id="testDiv"> &nbsp; </div> <script type="text/javascript"> $(document).ready(function() { var str = '<p>Just some <span>text</span> here</p>'; $('#testDiv').append(str); }); </script> As you are already using $(document).ready(), I believe you have ...


0

Is the code showing just the last user? Try this. //PRIMARY LIST DATA var dat=data.d.results; //LOOPING THROUGH ALL OF THE DATA for (var i=0;i<dat.length;i++){ //IF THE AUTHOR FIELD IS NOT DEFINED DO ANOTHER FOR LOOP var authors = dat[i].Author0.results; if (!authors){ name='No author listed'; } else{ for (var j = ...


0

Try to append a version wherever you are referring the JavaScript as example below. it will solve your issue. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script> <script type="text/...


0

According the below issue posted in GitHub, SharePoint REST API or PnP Core JS only sends an email to SharePoint site users NOT to external users. send email to external users PnP core js.


0

If your list name is "List_Tasks" then everything is fine in your code, you just need to add "/getbytitle" in your url after /lists. url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + myList + "')/items",


1

User the following function to Create ListItem in SharePoint List function CreateListItem(myList) { var listMetadataType = "SP.Data." + myList + "ListItem" var listNameInternal = GetListItemEntityTypeFullName(_spPageContextInfo.webAbsoluteUrl, myList); listNameInternal.done(function(data) { listMetadataType = data.d.ListItemEntityTypeFullName; }); $....


0

To add list item to list using REST API with jQuery code, the following code for your reference. <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script type="text/javascript"> var listName="CustomList"; function AddListItem(){ var itemType = GetItemTypeForListName(listName); var item = { "...


1

You can use below code. Note: Here through the line $("[title='Requester']").attr("id"), we are getting th ID of the people picker control whose title is Requester. So You can Replace Requester with the title of your people picker control. And It will work .. if(SPClientPeoplePicker.SPClientPeoplePickerDict[$("[title='Requester']").attr("id")]....


1

You can check if the people picker field is filled or not on click of your form Submit like below: var peoplePickerElement = SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerUser_TopSpan; var usersList = peoplePickerElement.GetAllUserInfo(); if(usersList.length) { console.log("Users added"); } else { alert("This field is required!"); ...


0

From the above answer there is a method "Hide fields" where I am getting an error: Unable to access the cssrules. So I have got the solution from the post: Hide more than one list column with JSlink OnPostRender: function(ctx) { ["col1", "col2"].forEach(function(name) { var header = document.querySelectorAll("[displayname=" + name + "]")[0]....


0

Please check out this workaround which is working for me: public static forceListViewUpdate() { try { let modules = (window as any).require.s.contexts._.defined; for (var p in modules) { if (modules.hasOwnProperty(p) && modules[p] && modules[p].itemInvalidator) { let itemInvalidatorKey = modules[p]....


1

This is SharePoint's default behavior that group created at the subsite level also reflect on the root site. The reason for this is it that you can always reuse groups at different levels like sites, lists and libraries.


Top 50 recent answers are included