Tag Info

Hot answers tagged

3

The proper syntax for loading SP.List.defaultViewUrl Property: context.load(list,'DefaultViewUrl'); Working example var context = SP.ClientContext.get_current(); var list = context.get_web().get_lists().getByTitle(listTitle); context.load(list,'DefaultViewUrl'); context.executeQueryAsync( function(){ console.log(list.get_defaultViewUrl()); ...


3

JSOM SP.Folder Class does not provide MoveTo method as SSOM SPFolder class does. But SP.File.moveTo(newUrl, flags) method could be utilized to move folder content (files) from source folder into destination as demonstrated below. How to move files via JSOM function moveFiles(folderSrcUrl,folderDescUrl,success,error) { var context = new ...


3

On Demand scripts are the one which we load only when we need it in a page. We put a reference to it but it won't load until we call for it instead of the usual one which gets loaded every time the page loads. A very good blog on this could be found here ExcuteOrDelayUntilScriptLoaded does not trigger loading an on demand script (SOD)! It schedules an ...


2

SharePoint may re-write your code in the content editor webpart. I suggest you take one of two approaches: In 2010/2013 you can create a txt file and store in a library. I suggest you place your code in that file and use the Content Link property of the Content Editor Web Part. This will avoid SharePoint overwriting your code or doing something funky ...


2

Try this: var profileManager = new UserProfileManager(ServerContext.GetContext(SPContext.Current.Site)); var profile = profileManager.GetUserProfile("domain\\username"); //instead of GetUserProfile use GetUserProfile(True); using (SPSite personalSite = profile.PersonalSite) { var personalSiteUrl = personalSite.PersonalUrl; } ...


2

Yes you can, but you will have to load the list item collection seperately like below and call executequery once. clientContext.load(collListItem); clientContext.load(collListItem1);


2

according to MS, ImageURL is Optional Text. Specifies a virtual server relative link to an image that presents an icon for the item. which means you should probably start with ImageURL="/myPics/myIcon.ico" or ImageUrl="/_layouts/images/workflows.gif" as already stated, try to use an ootb icon so that you can troubleshoot not the image format ...


2

When entering HTML content into a SharePoint page or web part, it will always modify the markup using SharePoint's black box. There is, however, a workaround that might work for you: 1) Use a Content Editor web part (you can insert one into regular page content or a web part zone) 2) Put all of your markup in an HTML or TXT file stored in a document ...


2

The default format for SharePoint REST endpoint is application/atom+xml. Instead of manipulating results returned in Xml format you could specify JSON format. Use accept header to specify the format for response data from the server. To get the results in JSON format, include an Accept header set to application/json;odata=verbose. Examples The code in ...


2

The dataview web part is executed server side, so you can't use jQuery to manipulate the SelectCommand. You would need to remove rows from the DOM with jQuery after the web part has loaded. I would use jQuery to hide the web part initially. Then, make your SPServices call to get the user's Office. Then iterate over each row of the table and if the Office ...


2

Did you even try to google? http://mysharepointlearnings.wordpress.com/2013/11/20/knockout-js-with-sharepoint-2013-app-ii/ There are plenty of results regarding your problem.


2

Your example contains the following errors/typos: To get fs object type use the following syntax: var fsObjType = selectedItem.get_fileSystemObjectType(); Another point is, ListItem object have to be requested first before getting it's value, this is why in your example it will not work. In fact, you don't have to request ListItem object in order ...


2

Don't add View Tag, reform the query as follows: CAMLQuery = "<Query><OrderBy><FieldRef Name='Fiscal_x0020_Year' Ascending='TRUE' /></OrderBy></Query>"


2

There's no easy way to do it, but nothing stops you from manually checking if the folder exists and then adding it if you need to, then copying files from inside to the new one: You can check if a list item is a folder by checking its content type (folders will be "Folder")... To get the content type you need to select and expand ContentType on each item ...


1

I would use a content editor web part with a text file for a content source, then put a style tag in there and not use JavaScript at all... <style> TH.ms-vh2:contains('Title') { min-width:250px; } </style> You could also do this by editing the HTML Source directly in the content editor, but I find SharePoint thinks it knows ...


1

var d = new Date("Wed Jul 23 01:00:00 UTC+0100 2014"); getFormattedDateWithOrdinal = function (date) { var d = new Date(date); var curr_date = d.getDate(); var months = new Array("January", "February", "March","April", "May", "June", "July", "August", "September", "October", "November", "December"); var ord = ""; if (curr_date == 3 || ...


1

Have you seen this post: Filter out items in list view using jslink Looks like you could do: overrideContext.Templates.Item = customItem; function customItem(context) { if(conditionIsNotMet) { return RenderItemTemplate(context); } else { return ''; //Hide Row somehow } } HTH


1

I am assuming you need to access host web announcement list, for doing so you need to get client context of the host web even before you do this var list = context.get_web().get_lists().getByTitle('Announcements'); Also, try to do some reading on SharePoint App Architecture. How App Web and Host Web are different.


1

There is a JavaScript function in SharePoint called "PreSaveAction" that is fired just before the item is validated and saved. You can use this function to call your function. For example: function PreSaveAction(){ SendProject('http://site.com/subsite/Lists/Projects/{@ID}_.000'); return true; } I've used PreSaveAction before for client side form ...


1

One of the ways to achieve the same result is to use knockout.js. You can use knockout.js and populate the data using a foreach loop in a observable array. And in the Web-Part you need to map the knockout data member. This is good because you will use object oriented JavaScript and MVVM. And code will be little less. Please check the following code: ...


1

You can convert the date time string returned into javascript datetime object, and extract the information required. Take a look at this link var date = new Date("2013-09-23T23:56:46Z");


1

You can use jQuery to get the inner content. var innerContent = $("div.edit-mode-panel").find('table:first').html(); $("#result").append(innerContent);


1

Maybe it's because all the SharePoint JavaScript-Files are not ready when you try to access your context. Instead of document.ready or similar, try this: _spBodyOnLoadFunctionNames.push("myCustomFunctionName"); //waits for all SP-Scripts function myCustomFunctionName() { // My custom functionality }


1

var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; if (inDesignMode == "1") { // page is in edit mode write code here }


1

Give that you are not using a sandboxed solution, you can use a Delegate Control, specifically the AdditionalPageHeadDelegate: You nee to create an ASP.Net Control (ascx file) where you will add the script and css references to the markup Add a feature, and scope it to Web Application Add an empty Elements.xml file to the feature ("Empty element" in the ...


1

You can use CSOM or REST api to get user's personal MySite url. //Get user's personal MySite url SP.SOD.executeFunc('sp.js', 'SP.ClientContext', GetUserProfileProperties); function GetUserProfileProperties() { //Get the current user's account information $.ajax({ url: _spPageContextInfo.webServerRelativeUrl + ...


1

May your problem is caused by MDS (minimal download strategy). Since your code is on the page but is not interpreted again, you have to attach it to the page lifecycle. For example with JQuery: $(function () { ExecuteOrDelayUntilScriptLoaded(function () { if (typeof asyncDeltaManager != "undefined") ...


1

This blog has a code snippet that is useful: // CREATE Operation // listName: The name of the list you want to get items from // weburl: The url of the web that the list is in. // newItemTitle: New Item title. // success: The function to execute if the call is sucesfull // failure: The function to execute if the call fails function ...


1

You'll need to retrieve Url parameter, then pass it on to your dynamicDisplay() function. function getUrlVar(key) { var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search); return result && unescape(result[1]) || ""; } Since you're already using jQuery, use $(document).ready(function () { var workArea = ...


1

At the end of the script, before closing it, write this line: window.onload = init_fieldsWA(); It'll run the script once everything on the page has been loaded. Or wrap the entire thing in a function, and then execute that function with the window.onload call. EDIT: Actually, looking at your code, just have window.onload = whatever you want to do when ...



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