New answers tagged

0

Looks like we forgot to publish the master pages in our target collections where we added the script tags. Once the master page got published, everything started working as expected.


0

I believe it is a publishing issue as Marco has mentioned. The way to debug it though is to try to log as a user from the visitor group and using the developer tools and see the version of your custom.js file and compare to another user from the owners group. personally, It happens to me couple of times, and I ended up just adding comments to the js file (SP ...


1

There are many ways to achieve this: Build an html page and add your css (inline or external even) then place a content editor web part where you like the photo to appear, and reference the html page you built. Create a custom display template and your query can be customized to pull this photo and our add you can build the UI to your requirements. Place ...


0

I was able to address this by changing some of the initial script to firstly run when the frame has loaded. <script type="text/javascript"> document.getElementById("myframe").onload = function() { var x = document.getElementById("myframe"); var height = height=document.body.clientHeight; document.getElementById("myframe").height = ...


0

Now issues is when I call Loadscripts function from ECS_ProviderSubmit.js, it just execute this.LoadScripts function and returns. Right, because you are doing a lot of async stuff and not waiting for it to be done before moving on to closing the modal. It looks like you are already using promises in the updateItemRequest function, so I would just ...


1

You can upload your image to sharepoint library (Site Assets ideally if it won't be changing too often) then add CEWP (Content Editor Web Part) to your page and inside CEWP add <img src="/sites/yourSite/yourLibrary/yourImage.jpg" /> Then you can also use css to design it, for example iof you need a border: <img ...


0

Below mentioned code is used to add user to SharePoint group. You will get idea from below mentioned sample code. UPDATED CODE public void AddUserToDMSite(string useremail, string securityGroupName, Web aWeb) { GroupCollection collGroup = aWeb.SiteGroups; Group oGroup2 = ...


0

There are few reason that might preventing your code to run Check jQuery reference added in your script editor. If you have added jQuery reference and still it is not working try your code by placing it in Content Editor WebPart. If you still face issue then track console in debugger of browser. And let me know if solved you issue. Thanks


0

You might be missing the jQuery reference on your page. Also make sure the IDs of the content are correct. Open the browser's console and check what exception you get. :) EDIT: As I understood, you are trying to resize the iframe to fit it's contents. The reason why your code doesn't work is taht #divContent is not actually on the page (it's in the ...


0

There are multiple issues with your code. Below are the issue and updated code You are querying the same list item on load as well as on edit button click. You can improve this by storing the list item and use it on edit On EditList function you are trying to use undefined object oListItem I have updated your code as below <h1 ...


0

Please Update "editList" function as follows and let me know if it is working - function editList() { var qString = window.location.href.split("?ID=")[1]; var clientContext = new SP.ClientContext.get_current(); var oList = clientContext.get_web().get_lists().getByTitle('DemoList'); var oListItem = oList.getItemById(ItemId); //ItemId ...


1

Use a standard Description column and apply CSR to make it look and behave anyway you want. CSS can clean the View /* ListView - make Description fields a maximum width and height, and show full text on mouseover*/ /*.ms-itmhover is the TR row*/ .ms-vb2 .ms-rtestate-field{ max-width:40em; max-height:2em; overflow:hidden; } .ms-vb2 ...


1

One possible solution: Create a Notes column, then create a list form, named something like "CustomEdit.aspx" that has nothing in it but the Notes field (hide all the other columns in the list), and use another column, named something like EditNotes to have the hyperlink to the custom edit form. Something like: ="<a ...


0

You can use ctx.ListData.Row to loop the rows, either in a CSR OnPostRender or any script after the View has loaded. Thing is, If you hide empty TD cells, the column header will still be there, messing up the layout. So you need to hide the TH column header as well. var fieldname = 'DueDate' , label = document.querySelector("a[id$='" + ...


0

I think you should modify AllItems View. Just click on ... (three dots) and click on modify this view. Uncheck column names that you don't want to view. Click OK. You are Done!


1

if you need javascript solution you can try this: $('a[name^="SPBookmark_{colname}"]').parent().parent().parent().hide(); Replace {colname} with desired column name which you want to hide.


0

If the list item is a document then you can use the MapToIcon method of the SPUtility class if (Item.File != null) { SPUtility.MapToIcon(Web, Path.GetExtension(Item.File.Name), string.Empty, IconSize.Size16); }


1

What you want to achieve can be done using OOTB SharePoint functionality. Have a look at "Folders" section when creating a view. This allows you to create views for your folders (not including the empty columns) and for the files within the folder (showing all columns). Nice blog about this option: ...


0

You can use decode URI component to remove all characters added in the URL and retrieve query string values JSRequest.EnsureSetup(); var q = JSRequest.QueryString["ProcessName"]; decodeURIComponent(q); Above code will provide you Query String values with Spaces as you have provided for redirection Below image is screenshot of page containing list view ...


0

If I understand you correctly what you will want to do is first have a column for the url to be stored in. By default this column will now be on the Newform.aspx page. The below code uses Jquery (which you will have to include) or you can edit the code to use just plain Javascript (which will be slightly faster if you are using it just for this). ...


0

It was just a matter of creating the "ctx" (ClientContext) from the same location where the object is being shared. So the clientcontext needed to be dynamically created with the object parent url. ex: Object url: "/sites/intranet/project/Shared Documents/document.aspx" ClientContext: "var ctx = new SP.ClientContext("/sites/intranet/project/")


2

Please follow the following approach. Create a Sandbox solution rather then creating the SharePoint App Deploy your solution to your SharePoint Online Solution Gallery Activate your solution Activate the feature of your newly activated solution I know this is not the ultimate solution but this solution worked at my end. Let me know whether it helped you ...


2

SP.ArrayListEnumerator don't have a count or length property. Your only option is to iterate and get the count as below var count = 0; while(SP.ArrayListEnumerator.moveNext()) { count++; } //SP.ArrayListEnumerator.reset() - Resetting so you can use it again from the beginning alert(count);


0

one way is to set your ajax call async to false


0

Thank you for this thread. I was able to to resolve my issue by inserting the following in a content editor web part on my page where I had ben using Bootstrap. I had to match the relatedWP to the specific webpart. <div id="ms-dnd-dropbox" class="ms-dnd-dropbox" style="display: none;" relatedWP="WebPartWPQ6"></div>


2

I am no exeprt yet, but spent the last days on CustomActions and REST because the New Library View has nothing SharePoint left but CustomActions (and no JSOM on the page it for creating/changing them) There are two types of CustomActions/Scriptlinks involved here: Type 2 = Site(Collection) Executes on every page inside the SiteCollection ...


0

Try to click on Advanced Mode button in Ribbon menu. That should "unyellow" all code. Be careful as in this mode you can do a lot of damage to your page if you do not know what you are doing and render the page uneditable by conventional means of Sharepoint (using Designer or webpage). Michal


0

Using CSR you can change the look and feel of List Views. Below is a sample I copied from https://code.msdn.microsoft.com/office/Client-side-rendering-code-0a786cdd/sourcecode?fileId=109730&pathId=1836828232 (function () { // Create object that have the context information about the field that we want to change it's output render var ...


0

I've recently had the same need. Unfortunately, I think there's no way to create a new document using REST, because you actually have to UPLOAD something. In my solution, I made a copy of the template and uploaded it to the library. var templateString = 'yourSite/pathToTemplate/templateName.docx'; var newDocString = ...


1

Simply it's to reduce traffic. If the file haven't changed, why not just use the cached version? I have experienced this plenty of times and my workaround is always the same: If I want to make sure the file is always reloaded I add a timestamp or auto-generated guid at the end of the file reference to ensure the cache is updated everytime.


1

Temporary solution/quick resolution: This error will occur when you have "Title linked with edit" field selected in your view. Remove this and hopefully it should start working fine. Long term solution: This happened due to misconfiguration in the list by any custom code trying to modify this. Unfortunately there is no direct way to identify the issue and ...


1

If you change the column type to single line you will lose all richness and new lines. There are three things I see that you can do: Change the column type and just lose all the richness and new lines immediately. Add a new single line text column and fill it with the text from the current column, and hide the current column. This will hold your old values ...


0

I ended up finding it by searching the nearest td. var videoFilename = $('h3:contains("Video Filename")').closest('td').next('td').text().trim(),


1

Yes, it is possible to create custom HTML, Javascript and CSS in your SharePoint site. A tool called SharePoint Designer is also available that shall help you to perform this. It is suggested that rather than this IDE it would better if you would use SharePoint Designer as it is designed for SharePoint specifically. You would be able to download this ...


0

If list doesn't contain any dynamic column one can use below script to achieve freezing header with vertical and horizontal scrolling. Note: Tested with SharePoint 2010 only //jquery lib <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> //style sheet <style type="text/css"> .fixedBlock { ...


0

No need for external ScriptFiles and (complex) JavaScript code; Let SharePoint do the work for you (this works in 2010,2013 & Online) see http://viewmaster365.com/#/How Add a Calculated Column Tip of the Day set to output a Date Paste Formula: ="<img src='/_layouts/images/blank.gif' onload=""{" &"var D=GetDaysAfterToday(new Date(" ...


1

The following worked for me. I didn't set the url like you are, just the leafname: function storeFolderTest() { var curLibrary = empLib; var l = arguments.length; for (var i = 0; i < l; i++) { var newFolder = new SP.ListItemCreationInformation(); newFolder.set_underlyingObjectType(SP.FileSystemObjectType.folder); ...


1

Instead of reusing the oListItem2 object for each new folder you want to create, try giving each new folder its own unique object. You can store them in an array like so: function storeFolderTest() { var curLibrary = empLib; var newFolders = []; // <-- new array for (var i = 0; i < arguments.length; i++) { // ... ...


1

The script editor web part will not execute in Google Chrome thanks to Chrome's built-in XSS Auditor. This is a feature of Chrome that is designed to mitigate Cross-site Scripting (XSS) attacks. There are ways to workaround this, but IMO a better solution is to just use JS Link. Upload the script file that you are wanting to run on the page, and then link ...


0

Did you check the markup of the page after you saved everything? Sometimes it can get stripped out. Save the page and look at it's source (Ctrl+U) and do a ctrl+f for your snippet. Another thing to check is if you have the Minimal Download Strategy enabled. Do you have start.aspx in the URL? I found that it interfered with my scripts. You can test if ...


0

I had the same problem and used the suggestion from Brandon in the above comments to get rid of it: Just call spListItem.refreshLoad(); before updating the item.


2

var clientContext = new SP.ClientContext.get_current(); this.oWebsite = clientContext.get_web(); gives you the web https://<tenancy_name>-<autogenerated_number>.sharepoint.com/sites/<development_site>/<addin_name>, so the code is actually querying the add-in web, not ...


1

Client side rendering or code to set fields won't work in datagrid view. I recommend using a workflow. Using the Wait For action (run workflow on create) is a better option than checking the status every time an item is edited.


-1

The solution ended up being: $($("[id*=ff681][id$=inplacerte]")[0]).html();


0

A simple workflow could accomplish this. May need to add some additional logic to prevent due date from being set again if the item is going to be modified frequently.


3

For client-side implementation, use JSLink to override field rendering. You can also add your javascript dropdown change handler to PostRender function of JSLink. Using server side, you can use event receiver to calculate Due Date on item created and updated events.


0

Have you tried checking the XML via REST? http://contoso.com/_api/lists/getbytitle('Listname')/items Then you should get the XML output and can check what the column is called. e.G. I get my Attachment Url and Attachment Description like this: <script type="text/javascript"> $(document).ready(function() { // Rest URL var ...


-1

To update my post, i found what i needed in JsLink CSR & CSS so if anybody have the same need : do think of that solution.


1

You can make a custom editform.aspx via SharePoint Designer to make the end date "read only". You have to change the ControlMode from "Edit" to "Display". There are also other ways with jQuery, JS or Powershell. How to create a new, display or edit form is shown here: https://afrait.com/blog/custom-new-edit-or-display-form-in-4-steps-en/ You can set the ...


-1

You have to remove the new keyword var clientContext = new SP.ClientContext.get_current(); should be var clientContext = SP.ClientContext.get_current();



Top 50 recent answers are included