Hot answers tagged

33

Juergen, The below article should help: http://www.collabware.com/blog/2013/03/22/tips-tricks-sharepoint-2013-modal-dialogs You have SP.UI.ModalDialog.showWaitScreenWithNoClose which can be used.. function RequestEnded(sender, args) { try { waitDialog.close(); waitDialog = null; } catch (ex) { } }; function RequestStarted(sender, args) { ...


20

This error occurs since tag variable is not defined. About eTag When updating or deleting items within SharePoint lists via REST you must specify the Entity Tag (eTag) value that was returned with the item during the initial query. This enables SharePoint to determine if the item has changed since it was requested. Alternatively you can tell ...


14

SharePoint is a huge historical monster. Core of the current paging implementation was introduced long ago, probably in SP2010 or even earlier. That's why your approach doesn't work: SharePoint isn't finding some html elements that are supposed to be there, and falls back to a simpler approach with link. Investigation Here is why it happens (you may skip ...


10

Here is an example that demonstrates how to query all search results using SharePoint 2013 Search REST API: function search(webUrl,queryText,rowLimit,startRow,allResults) { var allResults = allResults || []; var url = webUrl + "/_api/search/query?querytext='" + queryText + "'&rowlimit=" + rowLimit + "'&startrow=" + startRow; return $....


10

You need to call close() on object returned from showWaitScreenWithNoClose(). This works for me: var loading = SP.UI.ModalDialog.showWaitScreenWithNoClose(SP.Res.dialogLoading15); loading.close();


10

The OData provider for the REST API is configured to limit the number of items in a response to 100. It protects against developers inadvertently making a request that returns large result sets. If there are more items the response will contain a continuation. In a JSON response the continuation will be a property named __next. You can use $top if you ...


9

I was able to add a file with SP.RequestExecutor <%-- _lcid="1033" _version="15.0.4128" _dal="1" --%> <%-- _LocalBinding --%> <%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:...


9

What about using the Add method: If for example using SiteCollectionDocuments in a Site Collection 'url' : _spPageContextInfo.siteAbsoluteUrl + "/_api/Web/Folders/add('SiteCollectionDocuments/newfolder')" This shouldn't require the data payload 'postData'. See more here: http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx#...


8

Are you talking about SP 2010? Then you can use either the REST API or you can use the Client Object Model.


8

You cant add a WebMethod to a webpart. A webpart is a server control and outputs html to the page. If you want to use webmethods I would create a web service and consume this in the webpart or by other pages / controls. For these scenarios, we usually have an Application Page which defines all the WebMethods.. And than you can use the application ...


8

Ajax has nothing to do with jQuery per se. https://en.wikipedia.org/wiki/Ajax_(programming) http://blog.garstasio.com/you-dont-need-jquery/ajax/ http://caniuse.com/#feat=xhr2 jQuery has a function which wraps around JavaScript native 'Ajax' calls $.ajax({ type: "POST", url: "webservice", data: "a=1&b=2&c=3", success: function(d) {...


7

You can use the ECMA Script Client Object Model: ExecuteOrDelayUntilScriptLoaded(loadWebs, "sp.js"); function loadWebs() { var clientContext = new SP.ClientContext.get_current(); this.webs = clientContext.get_web().get_webs(); clientContext.load(this.webs); clientContext.executeQueryAsync(Function.createDelegate(this, ...


6

See if these paths to the row count variables work: data.d.query.PrimaryQueryResult.RelevantResults.RowCount data.d.query.PrimaryQueryResult.RelevantResults.TotalRows If you have specific questions about the object model, I find that the best first point of reference is to look at the returned xml or json using web developer tools and looking at the ...


6

Make sure the correct ServerRelativeUrl has been provided, the following formats could be specified: Server-relative URL: /<web url>/<list url>/<folder url> Site-relative URL: <list url>/<folder url> For example, to create a folder named Orders in a Documents library in a sub site Projects, you could specify: '...


6

You call your method showWaitScreenWithNoClose using asyncronously with callback ExecuteOrDelayUntilScriptLoaded. If sp.js is not loaded, then closing event can fire before the wait dialog is showed. Your code should look like this: var waitDialog = null; function BuildTable() { ExecuteOrDelayUntilScriptLoaded(function() { waitDialog = SP.UI....


5

You need to use the $expand option in your query string. siteUrl + "/_api/lists/getbytitle('" + listName + "')/items?$select=NameOfLookup/FieldYouWant&$expand=NameOfLookup/NameOfFieldYouWant" So yours would be: "/_api/lists/getbytitle('" + listName + "')/items?$select=$expand=status_x0028_test_x0029/Title&$expand=status_x0028_test_x0029/Title ...


5

First of all you have to Allow multiple selections in AssignedTo column. To add/update multi valued Person or Group column, you have to specify the ID's of the Persons or Groups like var data = { __metadata: { "type": "SP.Data.TestListItem" }, Title: "Some title", AssignedToId: { 'results': [11,22] } } You will find more in this CRUD ...


5

function addList() { var something = "ABC"; getData(url).success(function(data) { successHandler(data, something); }); } function successHandler(data, something) { console.log(something); console.log(data); }


5

Robs answer works, But you might as well move the whole function inside the addList scope (unless the function is called from other functions as well) The JavaScript .bind() method is the JS way of passing scope function addList() { var something = "ABC"; getData(url).success( successHandler.bind(something) //bind the function with a ...


5

The URL and endpoint seems right. But in success, you will get the return data in data.d.results array. So you can extract the ID of item from data.d.results array. In this case, You will not get the ID of item directly using data.d.ID. Try adding below code in success function: if(data.d.results.length > 0) { var xid = data.d.results[0].ID; ...


4

jQuery is one way to do this (feels like everyones choice nowadays). Since you're using a Visual Web Part an ASP.NET Timer control in combination with an UpdatePanel might be a preferred choice in your case, that will also fix both your problems; delay load and refresh.


4

I just did a test with SPServices where I set a Single line of text column to an empty string (""), which seemed to work just fine. This was with WSS 3.0 (the simplest test case, IMO). $().SPServices({ operation: "UpdateListItems", async: false, debug:true, listName: "Sales Opportunities", ID: 5, valuepairs: [["StateID", ""]], ...


4

It's throwing the error because the <asp:ScriptManager> tag is most likely defined in your master page, causing two instances on the page you are trying to load. http://social.msdn.microsoft.com/Forums/br/sharepoint2010general/thread/54c271ee-de71-4e47-b02b-29a1d540b81c


4

You can use $filter query string and a property called "Path" like /_vti_bin/Listdata.svc/myList()?$filter=endswith(Path, 'Folder001') to get only the items from the Folder001


4

I think that calling ASP.NET page method from a jQuery requires that the method being called be marked static and with the [WebMethod] attribute. Also, please note that jQuery can call ASP.NET page methods. Methods in a SharePoint Visual WebPart are technically user controls. Here is another question that covers this topic. As noted by Tim Ebenezer in ...


4

After reading up and a lot of fiddling i came up with setting the data attribute to the file and processData to false. This worked great, except for dropfile not supporting readAsArrayBuffer. So i used the above convertDataURIToBinary function. Now i have this and it works great. Remarks: files.data is added on the load event and i had to turn async of ...


4

You can raise the MaxRowLimit property of your Search service application (Only with On-Prem SharePoint installation) using PowerShell to overcome this limitation. But remember, it will affect the perform though.


4

Your issue is in understanding the async nature of JavaScript. The reason why there are no values is because you are attempting to access it before the executeQueryAsync function has returned and done it's job. Any logic that needs to access the values in globalTitle needs to be abstracted into a function or functions that can be invoked inside of the ...


4

Here is how I proceed : I bind the click on the SAVE/OK buttons with jQuery, and do my stuff, and then I trigger the original code. // bind the Save/OK buttons $('input:button[id$="_diidIOSaveItem"]').each(function() { var $this=$(this); // save the "onclick" action to call it later $this.data("on-click",$this.attr("onclick")); // remove the default ...


4

You don't have to deal with __metadata. Just specify your ContentTypeId in your request body and that's all. data: JSON.stringify({ __metadata: { "type": "SP.Data.Example_x0020_ListListItem" }, Title: "_", field1: "val1", field2: "val2", field3: "val3", ContentTypeId: "Your content type id" }) In the __metadata you need ...


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