Tag Info

Hot answers tagged

8

This page has some good examples on using listdata.svc and specific examples on drilling down into specific items to be selected. Using the REST Interface Examples from page Using code: var query = (DataServiceQuery<InventoryLocationsItem>)context. CreateQuery<InventoryLocationsItem>("InventoryLocations") .Expand("Part") ...


7

unfortunately, afaik (& tested) the REST services are only working for authenticated users. You'll need to create a bridge service calling with credentials the native ones if you want to provide that functionality but since you're authenticating your request, are you sure it's not an authentication issue ? Does the target username / password combination ...


4

I solved my problem Read file as an readAsArrayBuffer(file) pass that file.target.result as buffer in _arrayBufferToBase64 function _arrayBufferToBase64(buffer) { var binary = '' var bytes = new Uint8Array(buffer) var len = bytes.byteLength; for (var i = 0; i < len; i++) { binary += String.fromCharCode(bytes[i]) } return binary; } here return of ...


4

Well, I am not absolutely sure, but I think the answer is: there is no way to skip metadata property. You may of course create a kind of proxy by implementing a custom web service which itself consumes listdata.svc and truncates the "__metadata" property? But it doesn't sound good to me. You can of couse skip all other unnecessary properties by defining the ...


3

I assume that you don't have problems to get the SPFile. Here is a little example: SPFile xmlFile = ... using (var sr = new StreamReader(xmlFile.OpenBinaryStream())) { String xmlString = sr.ReadToEnd(); ... } OpenBinaryStream gives you back a stream. You will get the naked bytes back ;)


3

Set the Permissions on User Profiles = Read as mentioned in Rob's Answer and then the following code should work. We don't need to use request executor as we are not making a cross domain call here. $.ajax({ url:"http://<app web url>/_api/SP.UserProfiles.PeopleManager/GetMyProperties", headers:{ Accept:"application/json;odata=verbose" }, ...


3

You just use an HTTP PUT to place a file in a library. It's not so much REST as good old HTTP ... From that link: WebResponse response = null; try { // Create a PUT Web request to upload the file. WebRequest request = WebRequest.Create(SharePointPath); request.Credentials = CredentialCache.DefaultCredentials; request.Method = "PUT"; ...


2

Very interesting topic. The integration with Office 365 and SharePoint Online is possible. See the detailed instructions and examples for .NET, .NET again, node.js, python. I have tested it in javascript, in node.js and it works. There all you need to do is to install sharepoint node package. The logic is the same as in .NET or python or Java, the same as ...


2

Would it be possible to use the Client Object Model? This works for me: var ctx = new SP.ClientContext(); var items = ctx.get_web().get_lists().getByTitle('Pages').getItems(new SP.CamlQuery()); ctx.load(items); ctx.executeQueryAsync(function() { // Get the first items rollup image, just as an example var rollupImage = ...


2

Per Jakobsen has a very nice solution. You don't need to "muck up" anything, Chris! The only thing I have to add is to show how the REST url can be automated. Look at this: var date = new Date(), //or some relevant date filterFormat = "$filter={0} gt datetime'{1}'", filterQuery = String.format(filterFormat, "Created", date.toISOString()), url = ...


2

The $skip parameter does not work in SharePoint 2013 for list items. It only works for collection of data (like list collections, ecc..). See my comment at the end of this article: http://msdn.microsoft.com/library/d4b5c277-ed50-420c-8a9b-860342284b72.aspx


2

I actually found the solution: function getValues(listName) { $.getJSON('http://<page>/_vti_bin/ListData.svc/' + listName, function(data) { $.each(data.d.results, function(index, value) { i++; $('#select').append($('<option></option>').val(index).html(value.ID + " : " + ...


2

I have finally pinned it down. It turned out to be the feature of SharePoint's REST. I needed to take UI language into consideration! For instance, in case of en-us locale the REST query should look like this: ?$filter=endswith(Path,'FolderName') But in ru-ru it becomes: ?$filter=endswith(Путь,'FolderName') Moreover, you need to escape Russian ...


2

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


2

Although there is currently no API in the JavaScript CSOM which lets you change the search center url directly, SharePoint stores the search settings in the Property Bag of the root SPWeb object in a sitecollection. You can set these property bag values and your search settings should get modified. "SRCH_ENH_FTR_URL" – Search Center URL ...


2

Does it help if you set the ContentType parameter of your post like: $.ajax({ url: _spPageContextInfo.webServerRelativeUrl + "/_api/web/lists/getByTitle('Eleves')/items", type: "POST", contentType : "application/json;odata=verbose", data: JSON.stringify( { ...


2

To fall inside the same-domain restrictions of JavaScript you must have the same fully-qualified domain, including schema and port. I'm assuming your 'different physical machine' has a different hostname, so it is not same-domain. If you want to query across domains you will need to look at cross-domain ajax (e.g. CORS or similar). For completedness, this ...


1

I got this working using JSOM. I'm not happy about it though. It feels wierd to mix REST with JSOM. //Initilize JSOM contexts inside constructor var DataService = function(appUrl, hostUrl) { var self = this; //Some other stuff not related to this... self.appContext = new SP.ClientContext(appUrl); var factory = new ...


1

Finally found an easy way to do this. Looks like there are different web services to achieve different functionality. I finally added a web reference to http://server/_vti_bin/copy.asmx where server should be replaced by sharepoint server name Suppose, I give it a name CopyReference using System; using System.Collections.Generic; using System.Linq; ...


1

Lukie, I've recently written a post on how to access Term Store in SharePoint 2013 using the javascript "SP.Taxonomy.js" Hope it helps you. http://cann0nf0dder.wordpress.com/2013/04/09/accessing-taxonomy-term-store-with-jsom/


1

JSOM or REST API = no. BUT you can use JavaScript to call the Taxonomy Web Service to effectively accomplish client-side access. It's definitely more cumbersome than using the CSOM or REST API, though, but it works. Try this out: http://spandps.com/tag/web-services/ The taxonomy picker with suggestions uses this web service client-side.


1

If you have SharePoint in the Cloud (SharePoint Online/Office 365) and your data is in-house, here's one (supported) way you could do it: Surface your data from SQL in a web service you host on-site. Access this via JavaScript/client script code running in a SharePoint App. Create a Provider hosted SharePoint App, where your on-site hardware is the ...


1

You can make a REST call like _vti_bin/Listdata.svc/YourList/$count and it should return the number of items in the list. http://mstecharchitect.blogspot.com/2010/01/accessing-sharepoint-2010-lists-using.html


1

I have figured it out by myself, this is how it will work. This is code is updating title of list, title of web can also be updated by changing the uri and post data. Uri uri = new Uri("http://sp2013vm/_api/web/lists/GetByTitle('Tasks')"); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.ContentType = ...


1

You need to convert the image to binary data which you can pass as content. One way is to use below : function getBase64Image() { //if file:// dont work on your browser, you can find other alternatives. var img = new Image(); img.src = "file:///c:/images/image-to-upload.png"; // Create an empty canvas element var canvas = ...


1

Get items To get all items you can either call this url: http://yourhost/_vti_bin/ListData.svc/YourLib Or you can call this url: http://yourhost/_vti_bin/Lists.asmx with this payload: <soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' ...


1

Please try using "PackageLevel" in the REST Query instead of "Package Level" which is the display name of the field. What I have observed is that neither display name of the field nor its internal name work. It is actually the display name minus spaces which works. I have written a blog post about it here: ...


1

SharePoint 2013 has excellent features directed towards web content management, so apps doesn't really come to play here (unless you have some integration tasks you want to do). On top of the (lacking) WCM features we not have support for nicer URLS (good for SEO), alot better support for content publishing from intranet or staging environment, HTML5 ...


1

How about something like this: function getLookupFieldValuesFromListByTitle(listTitle, fieldInternalName, callback) { var ctx = new SP.ClientContext; var field = ctx.get_web().get_lists().getByTitle(listTitle).get_fields().getByInternalNameOrTitle(fieldInternalName); ctx.load(field); ctx.executeQueryAsync(function() { // Is not instanceof ...


1

SPServices doesn't "do" REST (yet), but the SOAP Web Services which it does support may well work for you. You can pass a webURL to many Web Services operations (as noted in the docs), including GetListItems, which sounds like the one you want. I've seen way too many truly odd network topologies and authentication models to say whether this will work in ...



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