Tag Info

New answers tagged

1

Depending whether taxonomy field is single-valued or or multi-valued use the corresponding method: single-valued taxonomy field: SP.Taxonomy.TaxonomyField.setFieldValueByValue by specifying SP.Taxonomy.TaxonomyFieldValue object multi-valued taxonomy field: SP.Taxonomy.TaxonomyField.setFieldValueByValueCollection Method by specifying ...


2

I guess you want to fetch List items using REST Api. Below is the endpoint for REST. /lists/getbytitle('listname')/items If you want more details, you can look into below URL, which is fetching data from SharePoint List using Javascript and REST API: ...


0

You can use JQuery to create menus as you like Please check the following link Please let me know in case of any query


-1

Try this code var tab = ribbon.getChild(your_tab_id);


1

The specified error could occur due to one of the following reasons: Column with Internal Name Value does not exist in the List Configuration Values Since SP.ListItem.item property expects field Internal Name, please make sure the field with such a name exists in List. List Item value for a field Value could not be loaded implicitly. Try explicitly ...


2

In SharePoint the "page" is actually inside of a DIV and the window really never scrolls... The content inside that DIV does scrolls (unless you have a customized branded site). So although your code will work on a standalone HTML page, it will not in a standard Sharepoint site (2010 and above)... See the solution I posted here to a similar question. ...


0

First thing I see is that $('ms-breadcrumb-top').css is missing the class identifier. It should have a '.' in the front. $('.ms-breadcrumb-top').css


1

You can get the list url from the get_defaultViewUrl method... when you load the lists you need to use the include statement to retrieve the defaultViewUrl property (it isn't included with the list results by default). Change your context.load line to: context.load(lists, 'Include(Title,DefaultViewUrl)'); Then inside of your iterator loop you can use ...


1

Inspect the return results using your browser dev tools -- my environment (using O365 and jquery 1.11.1) returns the results from $.getJSON(url, function(data) { //do something with data }); in data.value no d, or d.results This works on my O365 site: $.getJSON("/_api/lists/getbytitle('Laptops')/items?$select=Title,Id", function (data) { html = ...


1

I'm not sure why $.getJSON() does not work, but $.ajax() should work: $(document).ready(function() { var oDataUrl = "siteURL/_api/lists/getbytitle('Laptops')/items?$select=Title,Id"; $.ajax({ url: oDataUrl, type: "GET", headers: { "Accept": "application/json; odata=verbose", "Content-Type": ...


0

If you need to only show and not save it, you don't need ajax, you can find the creation date on the bottom : $("table:contains('Created')").text() Then, you just split it : var res = str.split(" "); and get the date: var date11 = res[3].split('/'); Then you just write there the difference.


0

This is internal names issue. Description filed internal name is Description0, Publih Date field name is Publih_x0020_Date.


0

First add the page you created the new web part to the Pages library. Lets assume the page name is Page1.aspx. Then in the page you need to add the link to it add it like this. <a href="javascript:OpenPopUpPage('/Pages/Page1.aspx');">Page Popup</a>


0

For new/edit form's, the inputs all have titles that are set to the field name. So if your field is called "Today", then the following jQuery selector will retrieve the field: $("input[title='Today']"); // If the field is a required field, then it will be title='Today Required Field' Then use .val(today) to set the inputs value. But this only helps you ...


1

I've used a technique like this in the past to handle the execution of jQuery after webparts ajax load or ajax refresh, http://stackoverflow.com/a/7062485/318776. Basically after the ajax call/postback is complete, it will execute your code. <script type="text/javascript"> Sys.Application.add_init(function () { ...


2

It looks like Microsoft have introduced the SiteLogoUrl property now within SPWeb in Office 365: http://blogs.office.com/2014/08/13/uservoice-driving-improvements-sharepoint-api/ and https://officespdev.uservoice.com/forums/224641-general/suggestions/6234945-make-the-sitelogourl-property-available-in-csom The <SiteLogoUrl> element is emitted from the ...


1

This is not possible with pure SharePoint Online/O365.


1

Even though Web class does not expose Groups property like SPWeb class does, you could still retrieve a collection that contains all the groups for the website. How to retrieve groups for a web Use RoleAssignmentCollection.Groups property to get the groups that directly belong to the access control list (ACL). for this securable object. CSOM using (var ...


0

I had the same issue here, and being an application developer in C++ I forgot that the tab/page instance holds the javascript environment in the same way that an undeleted pointer is held by an application for the lifespan of the application. So if for whatever reason your script fails and bails out, then the local SP namespace objects are now inaccessible ...


0

I realize that this response is very delayed but I figured out how to do this after a lot of reverse engineering and maybe this will save someone else some time. To better understand and improve on this example, it will be helpful to: Have an understanding of how a ribbon is created and how commands are registered Take a look at the sp.ribbon.js file and ...


1

The solution is similar to the one I provided in this accepted answer: Attach a Javascript function to an OOTB ribbon button. Here's the code, adopted for your case: <CustomAction Id="TrackDownloadsAction" RegistrationType="List" RegistrationId="100" Location="CommandUI.Ribbon"> <CommandUIExtension> <CommandUIDefinitions> ...


0

One option is to add a link to the item which has the attachement as a workaround if you don't want to add third party tools or Azure/Provider hosted Apps. In your e-mail template Define E-mail Message add a Link and edit the link with String Builder to get a direct link to the item. It's not an optional solution but it fairly easy for a user to click on ...


0

I have code I use to upload files using the filereader object. The uploadFile function is called on the event change of a file input and passes the event.target.files to the function. If you are using IE you will need to use a polyfill to provide the same functionality. I have used https://github.com/Jahdrien/FileReader. Event Object: jQuery('#' + ...


0

This would refresh the page if the parent was closed via a submit button and not by clicking on the 'X'. Clicking on the 'X' would not refresh the page. var options=SP.UI.$create_DialogOptions(); options.url=''; options.height = 400; options.dialogReturnValueCallback = function(dialogResult) {SP.UI.ModalDialog.RefreshPage(dialogResult)}; ...


1

Yes, you can do it from JS. The code will be something like this: (function () { var workflowInstanceId = 'PUT-YOUR-GUID-HERE'; var context = SP.ClientContext.get_current(); var web = context.get_web(); var servicesManager = SP.WorkflowServices.WorkflowServicesManager.newObject(context, web); var instance = ...


0

Try this $('#tbSearch').keypress(function(event){ var keycode = (event.keyCode ? event.keyCode : event.which); if(keycode == '13'){ //Your Code that you want to execute or simply call the function RedirectUrl() RedirectUrl(); } }); You need JQuery reference


0

According to the documentation: MSDN Use this simple code to set value people picker: //Get people picker Object var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict["peoplepickerID"]; // where peoplepickerID is ID of the element people picker that you could set value. peoplePicker.AddUserKeys(user.DisplayText); // set value, where ...


1

First of all, SP.List.getItems Method returns SP.ListItemCollection object not an SP.ListItem object. Second, in your case you have to submit first query in order to retrieve item collection and then only to get the item and delete it, for example: var items = list.getItems(query); context.load(items); context.executeQueryAsync( function() { ...


1

You are attempting to use a SP.ListItem method on a SP.ListItemCollection object. SP.List.getItems() returns a SP.ListItemCollection object. You must iterate through this to get to the items themselves. Try the following: function deleteListItemSP(title){ var siteUrl = 'mylink'; var clientContext = new SP.ClientContext(siteUrl); var oList = ...


0

If your goal is to remain true in using SharePoint 2013 OOTB, as a front-end developer, IMO, you should store your custom Javascript and CSS files in the Style Library. Make a sub folder within that location and store your items there. You could then reference your items from your custom .htm master pages and .htm page layouts. When you say... "My ...


1

Yes Master Page gallery is the recommended location in SharePoint 2013. But one thing that I have notified with that is it always go through an authentication check, which for every SharePoint document it does. This make things slow. (Might not be much visible with the single users, but depending on the Secure Store Service and the number of users access it ...


0

There are a lot of things that go into this and there are a lot of options, that is evident by this post. My personal best practice is reference libraries in the master page, like jQuery. Store these libraries in the layouts folder, if you have access to deploy them to the servers, otherwise I store them with javascript files that utilize the libraries. ...


1

If you can attach JS to the save action in your IFrame its quite easy. //set this in your IFrame when your item was saved var itemWasSaved = 0; if(yourItemWasSaved){ var itemWasSaved = 1; } //check if the item was saved via accessing the IFrame variable var iFrameItemInfo = $('#youriframe').get(0).contentWindow.itemWasSaved;


0

For the OR part.. How to get the SC URL from a full URL in JSOM Sadly the only way is try and error. Here's my code to get the SC URL (I wanted to get fields of a image listitem by its full URL) related SE post function getFileProperties(url, fileUrl) { //to get the file specific client context //you can create the ...


4

Sure you can. It's JS code after all and you could either use global variable to store your information or the provided ctx object. Here' a example for both possibilities: ControlTemplate: <!--#_ window.ThisIsGlobal = "this works !"; ctx.MyVar = "THIS WORKS !"; _#--> ItemTemplate: <!--#_ ...


1

I use to call REST like this in my current project: var formDigest = $('#__REQUESTDIGEST').val(); $.ajax({ type: "POST", url: "your URL here", headers: { "X-RequestDigest": formDigest }, contentType: 'application/json; charset=utf-8', data: JSON.stringify({ "ParamName": "Param Value" }), datatype: 'json', }) .done(function (data) { ...


0

Just found a way around! Using SPservices: function NuevaIncidencia(){ $('#Aceptar').attr("disabled", "disabled"); var values = [['Title', $('#titulo').val()], ['Descripci_x00f3_n', $('#descripcion').val()], ['Tipo_x0020_Incidencia', $('#tipo').val()], ['Prioridad', $('#prioridad').val()], ['Estado', 'Abierta']]; ...


0

Because you're working in an iframe, you'll have to call the parent document from within the frame. Follow these instructions: http://stackoverflow.com/questions/4689145/pass-jquery-variables-between-iframe-and-parent


1

You could use _spFriendlyUrlPageContextInfo.termId to get the Term information(GUID) for the current page.


1

This is a document library, and libraries don't follow the same conventions as regular lists with regards to the contents of the Title field. For a simple solution, you should find what you're looking for if you just use oListItem.get_item('FileLeafRef') as Vadim suggests. See below for some other useful info, but in summary when I run into something like ...


0

You need to declare the collListItemsEP variable globally so that it'll be defined when used in the success callback.


1

This would help. There’s a JavaScript API for Creating Ribbons! http://dbremes.wordpress.com/2011/01/16/theres-a-javascript-api-for-creating-ribbons/ Intro to Manipulating the SharePoint 2010 Ribbon with JavaScript http://sharepointtaproom.com/2011/09/09/intro-to-manipulating-the-sharepoint-2010-ribbon-with-javascript/ Plus, surely, the same stuff can be ...


0

I got it to work so I will share my victory with you. This code works if you need to get the Site collections paths, title etc. var queryUrl = spAppWebUrl + "/_api/search/query?querytext='sharepoint'&trimduplicates=false&rowlimit=400&refinementfilters='contentclass:equals("STS_Site")' $.ajax({ url: queryUrl, method: "GET", headers: { "Accept": ...


2

In order to retrieve File or Folder properties you could use the following associated List Item properties: FileRef - returns File/Folder relative Url FileLeafRef - returns File/Folder name Example function getListItems(listTitle,success,error) { var context = SP.ClientContext.get_current(); var list = ...


0

Using the client side object model or CSOM from SharePoint Online, you can retrieve the details of a list item and create a new list item. Basically, you would use at least two rountrips to the server from. First, you want to use the JavaScript library provided with SharePoint to get the SharePoint context, send an asynchronous query to SharePoint Online ...


1

I did this for a wiki. I added a new page layout instead of using a content editor, but the process should be quite similar. This will pick up any h1 - h4 header located on the page and include it in the TOC. It will add a hyperlink to the item in the TOC so you can navigate to that section directly. Place the <div> where you want the table to be. ...


0

You cannot add javascript directly to a content editor. You can add javascript to a content editor by uploading a text file to somewhere on the sharepoint site and then referring to it in the web part settings. Assuming your issue is the javascript being removed from your content editor. If you are using SP2013 you can also use a script editor web part to ...


0

What columns do you have added to the default view for the library? I've seen issues like this before when I had forgotten to add the columns I wanted to the default view. It seems unlikely Title wouldn't be in there, though... I also saw a similar SO question where the .load function uses an extra argument: clientContext.load(collListItem, ...


0

The getfilebyserverrelativeurl endpoint returns an SP.File object, so you need to select and expand the "ListItemAllFields" object with your document request to get the list item (SP.ListItem) that corresponds to your document, then you can expand to get the ParentList (SP.List) item for that document Append this select and expand statement to your list ...


1

It will depend upon how your master page is structured. A neat way would be add a new div wrapper inside #s4-workspace and add the CSS for the wrapper class. Include the css/reference from the master page: /* For Fixed Width */ div.wrapper { margin: 0 auto; width: 1000px; } /* For Fluid Width */ div.wrapper { margin: auto 5% !important; ...



Top 50 recent answers are included