New answers tagged

1

Try below approach. It worked fine for me. var siteUrl = "http://mysite"; $.ajax({ url: siteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { for (var i = 0; i < ...


0

I've recently had the same need. Unfortunately, I think there's no way to create a new document using REST, because you actually have to UPLOAD something. In my solution, I made a copy of the template and uploaded it to the library. var templateString = 'yourSite/pathToTemplate/templateName.docx'; var newDocString = ...


3

I was having the same query which you have. But unfortunately i found that REST Service does not supports GROUP BY functionality as per this REST Service But not to worry, you can still achieve this just you need to do some extra stuffs. The methodology which i used was Get all data from REST Service. Created a function which do required GROUP BY ...


0

You cannot use REST Service API call to sum up your list items as REST Service API calls do not support aggregate function. You can get data from REST Service API and perform aggregate function using client side scripting.For more information you can refer this Use REST to sum a column?


2

If you want to perform CRUD operation on SharePoint Online lists, for that you can use C# code with console app or window app or else create web application. The same requirement i was also having. So i used C# console application. And yes you need to authenticate first, and for authentication you can use Username and Password into the code itself which ...


0

As far as I see, neither the SPListItemVersion nor SPListItemVersionCollection object type are available in the client object model / web API interfaces. I suggest you to use the good-old web services, like the Lists.GetVersionCollection method to access the required information from the client side. For example (assuming you are using C# on the client ...


2

Using below mentioned functions you can upload document to Document library. Here you need to change the below mentioned code according to your needs like here it is mentioned document library name as "Project Documents" so please change it with your library name. You have to make three calls. The first uploads the file, the second retrieves the list item ...


1

Item can be created by calling REST service API from SharePoint workflow.SharePoint workflow provide various actions like call,Build etc. Build action is used to call your REST service API. Call action calls the REST service and execute the action that you have given into REST API. Please look at this Rest call using SharePoint workflow for reference ...


2

Yes it is possible to create *.docx file in document library using REST services. For more detail you can refer this MSDN article Files and folders REST API reference Let me know whether this helped you. Thanks


2

You need to allow CORS to be able to do this. The problem is that javascript doesn't allow cross domain calls, and the Azure service can't have the same domain name as your Office 365 (At least I'm pretty sure of this). By enabling CORS support in your Azure REST API, you can circumvent this. Do be warned however, that CORS must be supported by the browser ...


0

The following error: The property 'deleteObject' does not exist on type 'SP.ChangeQuery'. Make sure to only use property names that are defined by the type. occurs since the query for getchanges operation is case sensitive. Solution: replace deleteObject to DeleteObject Example url: https://contoso.sharepoint.com/_api/web/getchanges method: POST ...


0

I can think of a couple of Options: 1: Get all fields in item from rest and filter out SharePoint Default fields. 2: create a new Content type which contains all desired fields. _api/web/lists/getbytitle('Samples')/contenttypes _api/web/lists/getbytitle('Samples')/contenttypes('"+ contentType +"')/fields first one gets all Content types. Note there are ...


2

what REST call were you using? You should have been able to get a whole bunch of items using OData filtering. Something like this: var itemtitle = "Some Title" $.ajax({ url: _spPageContextInfo.webServerRelativeUrl + ...


0

I would say using Client Side Rendering(CSR)/JSLink would be a right approach. That way you don't have to worry about querying list and can just focus on building the html. Below is a link for some of the code samples using CSR https://code.msdn.microsoft.com/office/Client-side-rendering-JS-2ed3538a For the REST API approach, are you not able to get the ...


0

You can use RSS feed with selected columns from list & use that RSS feed URL in HTML page so you will get the result from the RSS feed. You just need to extract the RSS Feed details into HTML once. You can get the list data in SharePoint using it but only for view purpose. Follow steps below mentioned First of Publish your data for public view you ...


1

Based on what Danny said to me, I looked a bit further into the context of which the REST calls are made. Using this as my resource my working code looks like so: var SPHostUrl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); var SPAppWebUrl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl")); //Subsites ...


5

Appweb and Hostweb are two different origins, so something has to allow your AppWeb to access the Hostweb. If your code would work any script could access your site. Search for HostWeb AppWeb access on Google. Your IE most likely works because it was already authenticated on the Site.. try it with InPrivate browsing. PS: odata=verbose gives you a lot of ...


0

Can you check any differences in the headers sent to SharePoint? Maybe not exactly the same, but I had an issue with the Postman rest app in Chrome adding an origin header to the rest call that was not accepted. Another issue I had was having a CORS chrome plugin giving trouble. But this would not explain it not working in Edge. --edit I've had a closer ...


0

Many Thank to @Shelly Coburn. Her instruction put me in right direction. Below is the way to solve the issue. After getting httpsend we will get data as "d" : { "results" : [] } So I reassign dynamic value to itself Then In define properties I gave path Then I use ForEach loop as my original question but now reassign direct properties as ...


1

Before your foreach loop, assign a new dynamicValue to the d/results property of the GatePassDetailsProperties dynamicValue (or reuse and reassign the current dynamicValue). Then, for each item, you'll be able to get Title, Nationality, JobTitle, PassportNo as the top-level property. Also, make sure your assignments are going to variables and not the ...


0

You can use following end-point. It can search users from all directories. var userSearchSuggestionEndpoint = "/_api/SP.UI.ApplicationPages.ClientPeoplePickerWebServiceInterface.clientPeoplePickerSearchUser"; HTTP post request is needed to get data from above end-point. Request payload is given below. var data = { queryParams: { __metadata: ...


0

To get AD users in Sharepoint you have to put filter as /_api/web/siteusers?$select=Id,Title,LoginName,Email&$filter=id eq 'Your Id'


0

your rest call should be like url: "https://Myserver.com/sites/ibs/omt/_api/web/lists/getByTitle('Test')/items?$select=Title,Province/ID&$expand=Province&$filter=Province/ID eq '"+province +"'" It will work for you as while filtering you need to specify field followed by your look up column name


0

When I tried to use the Ahmed`s solution, I got the following error: Exception calling "Flush" with "0" argument(s): "Bytes to be written to the stream exceed the Content-Length bytes size specified." At C:\Scripts\UpdateItem.ps1:69 char:18 + $writer.Flush <<<< (); + CategoryInfo : NotSpecified: (:) [], MethodInvocationException ...


0

If you want to perform a rest query using $filter and content type id field, you can do it like below: http://siteurl/_api/web/lists/getbytitle('Documents')/items?$select=ID,Title&$filter=startswith(ContentTypeId,'0x0101') Insert the internal column names in the $select to get the column names.


0

This is probably because your field type is enhanced mutliline text. Instead if you switch it to plain text multiline, it should be able to return the data as is. I think you would need to create a new item after changing field type though. Old item will likely remain the way it is.


0

Well, it depends how you are getting the item. If you are getting it via the URL like this: /_api/lists/getbytitle('News')/items(50) Where the number in the brackets "(50)" is the item ID you can get an item e.G. like this: /_api/lists/getbytitle('News')/items?$filter=Title eq 'FAQ' So the URL is looking for an item, where in the title column FAQ is ...


0

Make this call before issuing your update to ensure you have a current form digest. UpdateFormDigest(_spPageContextInfo.webServerRelativeUrl, _spFormDigestRefreshInterval) See SharePoint 2013: How to refresh the Request Digest value in JavaScript for more information. SharePoint 2013 (and previous versions) uses a client side “token” to validate ...


0

It is not supported by REST api, you need caml query to pull items based on Target Audience. However you can use caml based REST call to get items based on Target Audiences. Here i am providing an example where i am making a REST call to get items based on current user Targeted Items. REST calls has the following inabilty. 1.Inability to filter items based ...


1

Use the AND operator to join the filters https://mydomain.sharepoint.com/mysite/_api/web/lists/GetByTitle('MyList')/items?$filter=Column1 eq 1 AND Column2 eq 2 AND Column3 eq 3


2

I have to say, I'm not a big fan of the do this for me questions, but this is a a good start to converting your JSOM to REST/AJAX. I haven't tested this, but this should be a good starting point for you. var qString = window.location.href.split("?ID=")[1]; var listName = "My list"; var collListItem; $.ajax({ url: ...


0

Found the answer, querying the draft project data will return project fields such as "IsCheckedOut", "CheckedOutDate" etc. which provide in-depth information about the current project check-in information. /pwa/_api/ProjectServer/ProjectData on the other hand does not provide any of the above information. Request: [HTTP/GET] ...


0

Getting the files and folders, from the library is not a big deal you use CSOM/REST Api calls recursively and can get the complete folder structure. But list like UI is almost not possible in the provider hosted addin. You can try the latest Office Fabric UI, to match look n feel but it won't give you all the features like list view.


2

(I must say it is embarrassing to admit this) I have (partially) done this with REST. I had used Newtonsoft.Json to parse the responses and HttpWebRequests to interact with the REST API. (I think you would be able to work with Atom using System.Xml as well.) However I am not aware of a single library doing the process end-to-end.


0

Another site collection should be within Same Origin Policy, so you should not get problems with cross-domain. This is not true for SharePoint. Each Site Collection is treated as a separate domain. So you have to enable CORS if you want to access a list from another SharePoint Site Collection, just as if you wanted to access content from the internet. ...


0

Here is my JSOM: factory = new SP.ProxyWebRequestExecutorFactory(appweburl); context.set_webRequestExecutorFactory(factory); appContextSite = new SP.AppContextSite(context, hostweburl); oWeb = appContextSite.get_web(); oList = oWeb.get_lists().getByTitle('pages'); fileCreateInfo = new SP.FileCreationInformation(); ...


0

$().SPServices.SPUpdateMultipleListItems({ listName: "Library", CAMLQuery: "<Query><Where><IsNotNull><FieldRef Name='Manager' /></IsNotNull></Where></Query>", batchCmd: "Update", valuepairs: [["Manager", "Yes"]] }); This answer ))


2

I only browsed your code You have to look closely at WHERE inside the then resolves your code runs, ie. if (errCnt>0) will run before attachments are found. Also try to merge your code, you have 2 branches that almost do the similar, merge them into one... your code will become smaller.. your code will be easier to debug


1

It is already mentioned in your REST query. You just need to change the value from 2917 to 1000. Make sure to place that as first parameter like below. https://xxxxxxxxxx/_vti_bin/ListData.svc/MapData?$top=1000&$select=State_abb,County,Indemnity,County_code&$orderby=State asc,County asc It will get only top 1000 records from list.


2

You can set your logo managed property any way you like. In my case I have a special site catalog content type that stores my site info (way easier than using the property bag). What I think you are missing is that the site "preview" is a live view of the site home page in an iFrame. In my case I modified the out of the box Item_Picture display template and ...


0

query ="?$select=ID,Title" url: _spPageContextInfo.webAbsoluteUrl+ "/_api/web/lists/getbytitle('" + listname + "')/items" + query, ID and Title are the column names of the SharePoint list specified(list name). _spPageContextInfo.webAbsoluteUrl gives the url of SharePoint. In success function you will get the ID,Title etc success: function (data) { ...


1

Here you can use any of the query but before that you must be clear with your own requirement. If you want to get data with specific parameter (like you want to filter your data) then you can use the following code Here i am just updating your code to pass the fieldname and fieldvalue. ( here i am assuming your list contain only one record, in case of ...


0

You can build your query in several ways and as per your need. But before coping code you have to understand your requirement as well rest api in 2013. Have a look in my article to get started. CRUD Operation to List Using SharePoint 2013 Rest API


0

Use the 'SiteLogo' property to get the site's logo. You can also limit the number of properties returned by using the following selectproperties='Path,Title,SiteLogo'


1

Found the solution... Check out the steps below: First retrieve the JSON (shown above) to a DynamicValue (i.e. ResponseDV) through an HttpSend activity. Use an GetDynamicValueProperties activity and use the above DynamicValue as source and the properties setup will like shown below. ParsedDynamicValue is a new DynamicValue, and the setting the Path is ...


1

I was pulling the data for online Share-point 2013/ office 365. I used the above method. But It did not return the desired result. I had created the two sample record on with date "2 april 2016". When i use the above syntax, It always return me only one record. I had spent two days to get this work. I made the following addition in above filter. $filter= ...


2

You could use the resultRendered, it will be called every time the result changes, like pagination. The page doesn't trigger document.ready again when it paginate. If you are using Display Template, you could add it in the Control template: ctx.ClientControl.add_resultRendered(function() { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', load); }); ...


0

Why not reduce it to 1 query like so? $.ajax({ url: "/_api/web/lists/items?$filter=Title eq 'Kunder' or Title eq 'Ansatte'&$select=Title", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: successHandler, error: errorHandler });


0

To merge data of two lists in a datatable, i have modified the above code so that it will work: //'use strict'; var appweburl; var hostweburl; var results; var allResults = []; $(document).ready(function () { hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); appweburl ...


0

Yes you can create a list view with REST API. To do that using the below method, you need to ensure that sp.requestexecutor.js is available and you have requisite permissions to create view. To create list view use below code: function createView(ListName, query ) { var bodyContent = "{ '__metadata': { 'type': 'SP.View' }, 'Title': 'View Name', ...



Top 50 recent answers are included