7

You can use the PnPJS to create modern team and communication sites. For that, simply add the below packages: npm install @pnp/logging @pnp/common @pnp/odata @pnp/sp --save After that, you can add the below import statement: import { sp } from "@pnp/sp"; And in the webpart, you can use it as below to create modern sites: 1) Modern communication sites: ...


7

You are in Online so I created a Flow which will do the work :) You can create another one, which will be started manualy and fix all existing documents, because I created it as for the new ones... In SPO Library click on Flow and click Create a flow: Click See more and select When a new file is added in SharePoint, complete a custom action: Here is the ...


6

There is a Microsoft sample project on github that does exactly the same. Looking at their code, it does mention that there is currently no way to refresh just the list view and their solution seems to be reloading the entire page using location.reload();. If you look at the file SpfxCloneCommandSet.ts they mention that there is currently no way to reload ...


5

You can do that with the most recent version (1.2.6) of PnPjs library: import { sp } from "@pnp/sp"; sp.site.createModernTeamSite( "displayName", "alias", true, 1033, "description", "HBI", ["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"]) .then(...


5

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/...


4

The difference between jquery call and the native httclient call is a method of making http asynchronous request. jquery uses old good xhr, but httpclient uses modern fetch api. When making CORS request with fetch API sometimes browser sends preflight request to understand server CORS possibilities (which origins are accepted, which headers, etc.). Your ...


4

Changing this falls outside of the realm of supported. Anything in the suite nav you should not touch with either CSS or JS overrides.


4

The best and simple way is to create a JS folder in your Style Library under Site Contents in the current site then reference it into your masterpage like this : <script src="https://tenant/yoursite/Style Library/yourProject/js/yourcustomscript.js"> and you can also make modification directly on your file in SharePoint Online and see results instantly.


3

We are not supported to increase the list view threshold in SharePoint Online. As a workaround, I recommend you creating filtered views or use folders to manage the items. Check the article to Manage large lists and libraries in SharePoint


3

Add the following code into script editor web part in list view page. <script type="text/javascript"> (function () { // Create object that have the context information about the field that we want to change it's output render var priorityFiledContext = {}; priorityFiledContext.Templates = {}; priorityFiledContext.Templates.Fields ...


3

To make it work you should reference "auto" version of es6-polyfill: <script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js"></script>


3

I'm not a 100% sure on this, but here is what I normally do... Rather than keeping the script from reruning, the script should be able to run again without breaking the behaviour. You are telling the form to perform an action when a field changes, which is good for user input, but the script needs to know what to do if the value is already set (which should ...


3

Plain JS: document.querySelectorAll("td.ms-formbody").forEach((function(x){ x.setAttribute("id","test");})); jQuery: $('td.ms-formbody').prop('id','test');


3

You need access token only in case if you are outside of SharePoint. For example, SharePoint provider hosted add-in, or a separate web site, which uses Azure AD authentication. As GET works for you just fine, I assume you are in a context of SharePoint site. In other words, you run your script from SharePoint site. In that case you don't need an access ...


3

Try to load the sp.js as the following var clientContext; $(document).ready(function () { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', Getdata); }); function Getdata() { try { clientContext = new SP.ClientContext.get_current(); } catch (err) { alert(err); } } If ...


3

Just split the value and use left part, which holds your id: var listItem = oList.getItemById(this.value.split(";#")[0]);


3

I tested below endpoint in fiddler, it works fine. Correct your endpoint as folders('folder1'). /sites/Developer/_api/web/lists/getByTitle('MyDoc4')/RootFolder/folders('SubFolder')/files/add(url='test.txt',overwrite=true)


3

For SharePoint Online or SharePoint 2016+ If you're running SharePoint Online or SharePoint 2016 or later, you can develop client side webparts in SharePoint Framework (SPFx). There's lots an lots of examples out there, and they're constantly updating it's functionalities. For more info, see https://docs.microsoft.com/en-us/sharepoint/dev/spfx/sharepoint-...


3

By exactly the same mechanism you are using to pull in the jQuery library. If you take all that code you have in your script block there, and put it in a file called, for example, myScript.js, and you upload that script file to a document library somewhere (maybe the same place you have the jQuery file?), you can make the embedded HTML: <script type="...


3

If users are coming to the form from different locations, then create different URLs for each source. (so, have different urls that each have a different ?Source attribute) If the URL is part of a global nav, and if users could be on a variety of pages when they click the URL, then javascript would be needed to customize the URL for each page that they're ...


3

Your table HTML is not valid since you are appending table related tags just one after one. Plus, you should put your closing tbody tag after the loop. table.append(`<tr><td>${item.Title}</td><td>${item.Rank}</td><td>${item.Franchises}</td></tr>`) That way, you get valid rows within your table body.


3

You could do it with these changes: Add the following attribute to the input field: ng-keypress="vm.myFunction($event)" Add the following function to your vm object: myFunction = function (keyEvent) { if (keyEvent.which === 13) { //enter pressed - here goes your code } } EDIT based on the comment: You could ...


3

I have found similar question on the same requirements. Please check the below links: How to retrieve files inside folder in document library using javascript SharePoint: Get Files from folder using JavaScript client object model Also there is a very helpful article related to working with folders and files in SharePoint by Microsoft. Check the article ...


3

In SharePoint JSOM, following is the correct way to set the lookup column in list: var lkfieldsomthing = new SP.FieldLookupValue(); lkfieldsomthing.set_lookupId(Lookup_ID); current.set_item('InternalNameOfLookupField', lkfieldsomthing); current.update(); Where: Lookup_ID : The unique, SharePoint default ID of the list item from where your are ...


3

You can use VALUE function to convert text to number. VALUE function Converts a text string that represents a number to a number. Syntax: VALUE(text) text is the text enclosed in quotation marks or a column reference containing the text you want to convert. Use below formula(If your Column A field always going to have valid number stored ...


3

If site url like http://sp, reference the library as: <script type="text/javascript" language="javascript" src="/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script> If site url like http://sp/sites/team, reference the library as: <script type="text/javascript" language="javascript" src="/sites/team/Style Library/Scripts/jquery....


3

While Joe McShea is correct in that there is no direct "distinct" type of operation through the REST API, as I learned in the answer I accepted to a question I had over on S.O., you can get distinct values through some clever querying. Now, I'm not sure you can do this directly using oData query options (although you might be able to), you could certainly ...


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[...


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....


3

Try using endpoint something like below: _spPageContextInfo.webAbsoluteUrl +"/_api/web/GetFolderByServerRelativeUrl('SitePages')/Files?$select=Name,Title,ServerRelativeUrl,ListItemAllFields&$expand=ListItemAllFields


Only top voted, non community-wiki answers of a minimum length are eligible