New answers tagged

-1

It worked for me like below : 1) Get user id like: $.ajax({ url: url + "/_api/web/currentUser", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { complete(data.d); }, error: function (data) { failure(data); } }); 2) pass the user id in the rest call as below: ...


0

With out file reader.Like safari 5.0. call openpageindialog on link. function openpageindialog(itemid) { var url = "/_layouts/Attachfile.aspx?ListId={LISTID}&ItemId=" + ItemID; var options = { url: url, width: 600, height: 400, dialogReturnValueCallback: function(result, fileAdded){ if(result == SP....


1

REST is only going to give the users results to what they have access to (I'm surprised the lookup column actually works as they currently don't have access to the data). If you don't give them permission, they won't see it. Set unique permissions on the list so everyone has read access, except for a group that will be responsible for maintaining the data. ...


0

You can use Copy Web Service method to upload document in SharePoint 2010 But it is not a method of REST API. Below is the article from where you will get all the details. Uploading Content Into SharePoint (Let me count the ways) Below is the code WORKING in SharePoint 2013 to upload a file in the same domain by using the REST API and jQuery 'use ...


0

Can you calculate, before starting making the request, how many request will be made? For example by counting the items in your viewresponse. Is you know how many request are going to be made you can check whether you have performed the last query in your deferred.done in main loop (comparing it to the index) and call InitData after the last call. If you can'...


1

async:false makes it work, but it ofcourse has the side-effect that all calls are in sequence (thus take longer) Since it looks like your async calls are not dependent on each other: you can issue them all at once (promise) Stick all Promises in an Array And wait for the whole Array of Promises to finish see: http://stackoverflow.com/questions/4878887/...


0

You can put async:false after method:"Get". method:"Get", async:false,


2

Look at your URL, it is created under the sites managed path,tenancy.sharepoint.com/sites/statistics So your REST call would be tenancy.sharepoint.com/sites/statistics/_api/search/query?querytext=%27focusing%27. tenancy.sharepoint.com/statistics isn't valid.


2

You can add $limit in conjunction with orderby=ID desc to restrict no of returned users /_api/web/lists/GetByTitle('Event')/items?$filter=Active eq 1$limit=2$orderby=ID desc You can also use $top=2 /_api/web/lists/GetByTitle('Event')/items?$filter=Active eq 1$top=2


2

var url = _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('Event')/items?$filter=Active eq 1$top=2"


0

The solution is https://domain.ltd/_api/search/query?querytext='*'&refinementfilters='write:range(2016-06-13T12:30:00.0000000Z,max,from="ge")'


0

You can try below code Approach 1 : $(document).ready(function() { var userID = <<input your user ID >> var siteUrl = <<input site url>> var soapEnv = "<?xml version='1.0' encoding='utf-8'?> \ <soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/...


0

If you want the root site of the site collection, it's: /_api/Site/RootWeb


2

For lookup columns, you have to use $expand. So the query URL should look like _api/web/lists/getbytitle('A')/items?$select=column1,column2&$filter=owner/LoginName eq 'i:0#.f|membership|username'&$expand=owner There are some special character in i:0#.f|membership|username, so you have to encode it before passing in query URL. encodeURI('i:0#.f|...


2

Yes it is possible through SPD 2013 workflow along with REST Webservice call. Follow the steps below, Create a list workflow for the list where Column1 is present Configure the workflow to get triggered on Item Adding and Item Edit Edit the workflow Build a dictionary with below parameters and set output variable as Request Header accept : application/...


1

There are lots of reasons mentioned in below article by which your query will not work & will not fetch the data from SharePoint List columns. One of the example given in below article is Well if you know SharePoint lists, you know you can change field display names, and many other things in List Settings. In the screen shot above, the “...


0

FOR CREATED BY: /_api/web/lists/getbytitle('Pages')/items(1)?$select=Author/Name,Author/Title&$expand=Author/Id FOR MODIFIED BY: /_api/web/lists/getbytitle('Pages')/items(1)?$select=Editor/Name,Editor/Title&$expand=Editor/Id I TRIED THIS QUERY. IT WILL GIVE YOU THE CREATED BY OR MODIFIED BY USER'S DISPLAY NAME


-1

I guess the following links helps: How to: Create and Retrieve a Social Tag How to: Learn to read and write to the social feed by using the REST service in SharePoint 2013


0

It turns out the issue was due to a bad record that came over from migration. A required 'Person or Group' field was left null possibly because a user didn't exist between the move from UAT to PROD. To discover this, I used the $top clause to determine which record was the culprit https://<siteURL>/_vti_bin/listdata.svc/Project?$select=ProjectName,...


1

Taxonomy API is not supported via REST service but you could consider to create a term via JSOM API in SharePoint-hosted app as demonstrated below: var sp_files = [ 'SP.Runtime.js', 'SP.js', 'SP.Taxonomy.js' ]; var layoutsPath = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/"; $.getMultiScripts(sp_files, layoutsPath).done(function() ...


0

Try this endpoint URL to get the Multi Choice Lookup field data: var url = "/_api/Web/Lists/GetByTitle('Product Type')/items?$select=Owner/Title&$expand=Owner/ID"; To retrieve the data of each values of multiple field use below code, var items = data.d.results; var owners; for (var i = 0; i < items.length; i++) { owners = items[i].Owner....


9

Check out this excellent article where the performance of both is tested: Deep Dive – REST and CSOM Comparison I tested a series of pretty common operations in both REST and CSOM: Creating Lists (10) Creating List Items (100 per List, for a total of 1000) Reading List Items by ID Querying for List Items (retrieving 50 per List) Deleting List ...


2

Nice question, "Which one is faster CSOM or JSOM for CRUD operation?". But the fact to determine which API to be used for performing a certain operation in SharePoint depends on various factors like type of application, operating system, what kind of operation is to be performed in which system and so on. Based on the MSDN reference, I would say, go with ...


-1

Use OData__ModerationStatus with SP2013 REST API (note: 2 _ between OData and ModerationStatus)


1

Liz, I was having similar issue but I followed this link http://summit7systems.com/who-needs-a-data-view-web-part-sharepoint-rest-and-datatables-net and it worked perfectly. Following is my code (see if it's helpful) <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script> <link ...


1

You have to explicitly request for a JSON response (if the default response is XML) You need to give the server the RequestDigest (unique token) to prove you are who you are headers: { "accept": "application/json;odata=verbose", "X-RequestDigest": $("#__REQUESTDIGEST").val() }


0

No, you can only process only one web in a single REST call. First of all, how did you refernce a lookup field from a list that is present in another web? Iguess that should be a custom feature using cross site publishing. But REST cannot be used in that way. Only if your 'Document Library' and the lookup list is present in the same web you may get the ...


0

Couple of issues Person class should be set as Serializable GetDate method accepts 0 parameters but you are passing two values from the Ajax call. Sample Service public partial class Services : LayoutsPageBase { [WebMethod] public static string Hello() { return "Hello"; } } Sample Ajax Call var url = _spPageContextInfo....


0

You need to use multiple REST API's calls to expand each of the folder's. Something like /_api/web/lists/GetByTitle('KnockoutList')/Items(1)?$expand=folder Where 1 is the ID of the folder Another approach is to use SP.CamlQuery and use <View scope='RecursiveAll'>


0

You can make use of REST Search EndPoint and target the list path to search upon Format is http://server/_api/search/query?querytext='MY_SEARCH_TERM+path:"http://server/lists/MyList"'


0

For debug purpose, use the broswer console. Identify your REST Call in the console's XHR tab. If red, REST call returned an error: => either query is wrong or SP threw an exception If not red, REST call returned success, even though it has no results: => your query is ok. Right-click to open call in a new tab to see xml results on browser, or ...


0

Use this: /_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='FirstName,LastName')?@v='accountName' Then you will have a FirstName and LastName property


0

This was the exact problem I was facing. This is an old question but my answer might be helpful to someone else coming here. It is possible to do this. First you have do OAuth from standalone web-app. Here are the step by step instructions in my blog - https://medium.com/@yash_agarwal2/performing-oauth-and-rest-calls-with-sharepoint-online-without-...


1

add a $select=myfield1,myfield2,etc onto your REST url. Note that once you add the $select parameter, only the fields you explicitly select will be returned. Without a $select parameter, all built-in fields are returned. See official doc on MSDN


0

Here is the RESTful URL you need to get the current file version of a specific file (by its ID): http://MY_WEB_SITE/_api/web/lists/getByTitle('Documents')/items(1)?$select=FileLeafRef,OData__UIVersionString Here is the RESTful URL you need to get the current file version for all files in the library: http://MY_WEB_SITE/_api/web/lists/getByTitle('Documents')/...


1

You can get the specific file's version using REST call by below given code. // Get the file versions function getFileVersions() { var getfileurl = document.getElementById("getfileurl").value; var executor; // Initialize the RequestExecutor with the app web URL. executor = new SP.RequestExecutor(appweburl); ...


3

I think I got it. The ACCEPT header parameter "odata = verbose" makes all the difference. Using it returns the "d/results" path. Not using it returns "value" path. I understand that there is no need to add it any more with new specs. Further details here: https://blogs.office.com/2014/08/13/json-light-support-rest-sharepoint-api-released/ Edit: Also I ...


0

You do overwrite the ModifiedBy value. But what does SharePoint do after your update? SharePoint sets the ModifiedBy field to the User who did/triggered the update


2

To fetch data from sub-site based on country of logged in user, you can use: Content Query Web Part (create your own Content Type and query across sub-sites, requires either Publishing site or use the trick to create a Style Library on Top-Level site where you copy all XSLT) DataView web part with linked data sources (not so flexible or easy to modify for ...


1

Try below rest call This will get data from the current page location var getTitleURL = "/_api/web/lists/getbytitle('Products')/items? and this will var getTitleURL = "/subsitesites/_api/web/lists/getbytitle('Products')/items?


2

It sounds like you need to be able to show your users a listing of all the tasks they have open, from a number of SharePoint lists. Use a Content Search Web Part for this. It enables you to grab all tasks from all lists in your environment and show them in a single web part. It will perform much better than your current approach. It also scales better (i.e,...


0

**<script src="../SiteAssets/JQUERY/jquery-1.12.3.min.js"></script> <script> var RESTURL = "https://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i%3A0%23%2Ew%7Cdomain%5Cloginname'"; $(document).ready(function () { GetUserInformation(); }); function GetUserInformation() { var self = this; $....


1

Use this endpoint url to reset the permission, this will reset the permissions which means it will inherit the parent permission. url : <site URL>/_api/Web/Lists/GetByTitle('<list name>')/items('<item id>')/resetroleinheritance The above URL will reset the permission at the item level, you may implement the same for list or site level.


1

Similar to breakroleinheritance you can use resetroleinheritance endpoint https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.resetroleinheritance.aspx


0

I too tried creating a folder using REST API as mentioned in MSDN site. I too faced the same issue, folder is getting created but when i view the properties of the folder the Name field is empty, but while editing the same, Name field gets the folder name as value. To investigate more on it i just tried creating a sample folder through UI directly and tried ...


1

There is no inconsistency. There might be a space somewhere that is breaking your HTTP request. Can you make sure that the ListName bit has no spaces in it? If you are using the Workflow Context: List Name, then this probably has spaces in it. If you have a list called "My List" this is how your calls should look like: MySite/_api/web/lists/GetByTitle('My ...


2

Make it a boolean. Tested it out on my end and this is what worked. sitecollection/_vti_bin/ListData.svc/TestList?$filter=IsNum eq true


0

This is from the sharepoint documentation. function createFolder(resultpanel) { var clientContext; var oWebsite; var oList; var itemCreateInfo; clientContext = new SP.ClientContext.get_current(); oWebsite = clientContext.get_web(); oList = oWebsite.get_lists().getByTitle("Shared Documents"); itemCreateInfo = new SP.ListItemCreationInformation(); ...


1

If it is SharePoint Online than you can use below code. "Property You want": { "__deferred": { "uri": "https://c986.sharepoint.com/_api/Web/Property You want" } SharePoint 2013 introduces a Representational State Transfer (REST) service that is comparable to the existing SharePoint client object models. This allows the developers to interact ...


0

I believe the information required is on consultantpoint's wordpress site. I have made one correction and added the binary column for easier reference. | Permission Name | Hex (base 16) | Binary | Decimal | |------------------------------|--------------------|------------...



Top 50 recent answers are included