New answers tagged

0

This is the code i use to get videos info from a "Asset Library", maybe this can help you. I don't know how to get the preview pic but should be right there: getDataFormVideosList:function(next){ var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml('<View>' + '<ViewFields>' + ...


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

Like Amal Hashin said, you've opened a <FieldRef>, but you should close it like that : <FieldRef Name='Mise à jour parc' /> <Value Type='Text'>Non</Value> Also I saw a mistake in your code. You use collListItemToBeUpdatedReventeas variable to print the result of the query. The problem is that you use that variable several times in ...


1

Your query is wrong. Try below query instead camlQuery.set_viewXml("<View> <Query> <OrderBy> <FieldRef Name='Mise à jour parc'> </FieldRef> </OrderBy> </Query> </View> ");


0

Can you try with this SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){ getItemsToBeUpdatedReventeTot(); getItemsToBeUpdatedReventeMaj(); }); Hope this should work. or you can also try with _spBodyOnLoadFunctionNames.push("getItemsToBeUpdatedReventeTot"); _spBodyOnLoadFunctionNames.push("getItemsToBeUpdatedReventeMaj");


1

You can use the JavaScript Object Model to create and delete items. For reference, see Common Programming Tasks in the JavaScript Object Model, the SP Namespace, and SharePoint 2010 Client Object Model Hierarchy and Identity. Here's an example function to get you started: function moveItem(sourceItemId){ var sourceListTitle = "My Source List"; var ...


1

Try this if it works for you. You can avoid first five items using below mentioned listitems.getEnumerator() code. function getItemsToBeUpdated() //this function called on button click to get ID's { var clientContext = new SP.ClientContext.get_current(); var oList = ...


0

I would grab the first 10 items, store them in an array, then return the last 5 items from the array.


2

SP.CamlQuery does not have a property RowLimit , you have to set in the caml markup: camlQuery.set_viewXml("<View><Query> <OrderBy> <FieldRef Name='ID' Ascending='False' /> </OrderBy> </Query> <RowLimit>5</RowLimit> </View>");


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.


1

You need to use Client Object Model. Look in this link for basic operations: https://msdn.microsoft.com/en-us/library/office/jj163201.aspx#BasicOps_SPListItemCRUD Form this links, you have sample to create and delete items(like a move) Create: function createListItem(siteUrl) { var clientContext = new SP.ClientContext(siteUrl); var oList = ...


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.


2

Override the PreSaveAction in order to cancel the save. function PreSaveAction() { if (confirm("Confirmez-vous ce choix de réforme ? : ")) { return true; } else { return false; } }


1

On your saveitem button click event call below method $(document).ready(function(){ $( "#ctl00_m_g_9ff78e92_ed40_4212_ae0f_44b787664fa8_ctl00_toolBarTbl_RightRptControls_ctl00_ctl00_diidIOSaveItem" ).click(function() { /*var isConfirmed = confirm("Confirmez-vous ce choix de réforme ?"); if (isConfirmed == true) { ...


2

what REST call were you using? You should have been able to get a whole bunch of items using OData filtering. Something like this: var itemtitle = "Some Title" $.ajax({ url: _spPageContextInfo.webServerRelativeUrl + ...


0

I would say using Client Side Rendering(CSR)/JSLink would be a right approach. That way you don't have to worry about querying list and can just focus on building the html. Below is a link for some of the code samples using CSR https://code.msdn.microsoft.com/office/Client-side-rendering-JS-2ed3538a For the REST API approach, are you not able to get the ...


0

You can use RSS feed with selected columns from list & use that RSS feed URL in HTML page so you will get the result from the RSS feed. You just need to extract the RSS Feed details into HTML once. You can get the list data in SharePoint using it but only for view purpose. Follow steps below mentioned First of Publish your data for public view you ...


0

Below code will help you to get month. var d = new Date(); var n = d.getMonth(); You can assign the value to var d from the HTML date control's output (like var d = inputdateObject.value) Please note that month number starts from 0 like 0=January, 1=February etc. Than after you can replace the month as per the number in your output.


0

qString= null; $( document ).ready(function() { var qString = getdetails(); if(qString != null) { $.ajax({ url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbyTitle('My list')/items/?$select=Title,Name,Age,DOB,Indian&$filter=ID eq "+qString, method: "GET", ...


0

You can add a callback on the SP.UI.ModalDialog.showModalDialog method. You will want to use dialogReturnValueCallback. There is an example in an answer on another question that should get you going in the right direction. SharePoint Modal Help - pass value back to parent when closing Using this you can reload the page if a new item is saved or updated ...


2

Your code fails because the Function declaration is wrong: You do: function getdetails( {dosomething} ) But the correct way of declaring a function is: function getdetails() {dosomething} BUT, More potential errors: Your code tries to extract the ID value when it is the first QueryString parameter in the URL So it fails: When ID is not immediatly ...


0

var result; $( document ).ready(function() { getdetails(); var qString = result; }); function getdetails() { result = window.location.href.split("?ID=")[1]; return result; }


0

Please check the getdetails function.Code is inside () function getdetails(){ var result = window.location.href.split("?ID=")[1]; return result;};


0

Please try below mentioned code. var result; $( document ).ready(function() { getdetails(); var qString = result; }); function getdetails() { result = window.location.href.split("?ID=")[1]; }


0

Your returning true after each check. A return means that you leave your code which means that the first time you hit a return no more code is used. What you want to do is dirty bit handling. Make a new var valid and set to false. Replace the return true statements with valid = true. at the bottom have an if(valid){ return true; } alert(message); ...


0

Proposing some other solutions... Given that you have a people picker called ppobject: var ppobject = SPClientPeoplePicker.SPClientPeoplePickerDict["my_peoplePicker_TopSpan"]; To delete the last user in the people picker, you can call ppobject.DeleteProcessedUser() This is ultimately what's happening in the accepted answer, for as many times as there ...


0

<script type="text/javascript"> ExecuteOrDelayUntilScriptLoaded(queryListItems, "sp.js") var itemId = 2; // Set your listitem id var counterListItem; function queryListItems(){ var clientContext = new SP.ClientContext(); var counterList = clientContext.get_web().get_lists().getByTitle('CounterList'); counterListItem = ...


1

You're missing semi-colons. Also, why are are you calling location.reload twice? $(document).ready(function () { $('#btnViewReport').click(function () { location.reload(true); }); });


0

Just put the tabs in a Content Editor Web Part and make each tab link to the corresponding view. I would reference a html file in the Content Edit Web Part on each page so that if it needs to be changed, you only have to change it in one location. If you need the active tab to be a different color, create an active class and set that in another content ...


6

To average multiple columns in an item, you'd use a calculated column such as =AVERAGE([Column1],[Column2],[Column3]). To average a column, edit the view and expand the Totals section. By your column name, if it's a number, you can select average (etc) from the dropdown.


0

Thanks for everybody's responses. Close to jpussacq's question I was able to get it working by using the lists hidden attribute by using the set_hidden(true) in the following way: //JSOM example ExecuteOrDelayUntilScriptLoaded(hideListItem, "sp.js"); function hideListItem(){ var ctx = new SP.ClientContext().get_current(); var thisList = ...


1

Try this var list = ctx.Web.Lists.GetByTitle(listTitle); list.Hidden = true; list.Update(); ctx.ExecuteQuery(); Source: Hide document library using CSOM Note that in the source they use BreakRoleInheritance to prevent users from accessing the list.


1

Make the menu items stretch: span.menu-item-text { display: inline-block; white-space: nowrap; } Make the container resize to fit: ul.dynamic { width: auto!important; }


2

To fix the problem with the text getting out of the box, use the following solution: ul.dynamic { width: auto !important; white-space: nowrap; } Source: http://blog.sharepointexperience.com/2014/10/increase-width-sharepoint-drop-down-navigation/


4

You need the following piece of CSS to ensure that the menu items on the global navigation menus do not break into multiple lines and that the width of the drop-down menu extends to fit the length of the menu items' text: /* Disable menu text wrapping. */ #DeltaTopNavigation ul.dynamic { white-space: nowrap; word-wrap: normal; width: auto !important; ...


0

From the look of it's not an easy fix, I have not used that script before, but a quick test shows it's a problem with the ribbon. Probably losing some context at some point. And what it does then is to call the DeselectAllWPItems function. Tbh SP.Ribbon.js is way to complicated to worth trying to override for this script. Probably best to write a better ...


0

I have used it in one of my project & it is working like a charm with 3 listview WebParts in each tab. Please check this link if you failed to follow any of the step from this.


0

You can use below line in your master page to access your JS file anywhere from entire site collection. <script type="text/javascript" src="<asp:Literal runat='server' Text='<%$SPUrl:~sitecollection/Style Library/Envera/Js/jquery-1.10.2.min.js%>' />"></script>


2

I only browsed your code You have to look closely at WHERE inside the then resolves your code runs, ie. if (errCnt>0) will run before attachments are found. Also try to merge your code, you have 2 branches that almost do the similar, merge them into one... your code will become smaller.. your code will be easier to debug


0

If I take a guess I would say your local links only link to anchors (#) in the href attribute. Whereas the sharepoint links have a path containing / in the href attribute. This is fixed by changing the code in your onclick event handler to only use the part after the # to find the scrolling target element.


1

It is already mentioned in your REST query. You just need to change the value from 2917 to 1000. Make sure to place that as first parameter like below. https://xxxxxxxxxx/_vti_bin/ListData.svc/MapData?$top=1000&$select=State_abb,County,Indemnity,County_code&$orderby=State asc,County asc It will get only top 1000 records from list.


0

You are not allowed to modify app-contents via cross-domain. But there are possibilities to get the current design from within the iframe. //Build absolute path to the layouts root with the spHostUrl var layoutsRoot = strHostUrl + '/_layouts/15/'; //Create a Link element for the defaultcss.ashx resource var linkElement = document.createElement('link'); ...



Top 50 recent answers are included