New answers tagged

0

When you add a folder in SharePoint using the Web UI, it actually adds two things: the folder and a list item. It's the list item that shows up in the List View. Also, there are two names. The name of the list item and the name of the folder. You set the name of the list item by setting the Title field value and you set the name of the folder by setting the ...


2

The OData provider for the REST API is configured to limit the number of items in a response to 100. If there are more items the response will contain a continuation. In a JSON response the continuation will be a property named __next. var url = appUrl + "/_api/Web/Lists/getByTitle('Order Details')/Items"; var message = jQuery("#message"); ...


3

It's still weird that $orderby does not work with Likes and Calculated Type columns. So now can do following things. Sort them in client side Ignore $orderby from url var uri= appweburl + "/_api/SP.AppContextSite(@target)/web/Lists/GetByTitle('listName')/items?$select=LikedBy/Title,LikedBy/ID,Title,Id,LikesCount&$expand=LikedBy&$filter=" + ...


0

You can update your query as /_api/Web/Lists/getByTitle('Tasks')/items?$filter=(Author eq 12) The SharePoint REST removes the Id appended to any of the lookup Field or people-picker


0

I did find this post. Don't know if it is complete or up to date. Fixe Size and Source URL didn't work for me. Name FileLeafRef Name LinkFilenameNoMenu Name LinkFilename Name BaseName URL Path FileRef Path FileDirRef File Size File_x0020_Size File Type ...


1

You can apply some conditional filtering like following: var filter = ""; if (statusFilter) { filter += "status eq '" + statusFilter + "'"; } if (!statusFilter) { filter += "status ne 'Rejected'"; } if (categoryFilter) { filter += "and category eq '" + categoryFilter + "'"; }


2

It looks like the query is working as it should. Your selector looks off. Try Item.AssignedTo.results.FirstName


0

For uploading file, AngularJs does not work in jQuery way! In earlier time, I had a R&D and made it working. Find below: function fileUploadRequest(data, url) { var deferred = $q.defer(); $http({ url: baseUrl + url, method: "POST", processData: false, data: data, ...


0

If I had ran into such an issue on SharePoint on-prem, the first thing to try would be to CA > Manage Web application > General Settings in Top ribbon > Resource throttling > Increase the value from 5K to 20K for general audience. Not sure if it works the same way with SPOnline. Also, in general, if the query is breaking because it is expected to return ...


1

I too am in the early months of using the SharePoint (Online) REST APIs and on the whole are liking the experience. A browser add-in I've found very useful to expand the results of and debug REST API calls is http://restclient.net/ Once I know I've got a successful call, I've found it straightforward to drill down into the results using the d.results[n] ...


0

The original error indeed occurs when digest has been expired or it could not be retrieved ( e.g. SharePoint:FormDigest control is not available on the page) on the page. There are some another issues with the provided example. For updating list item the following parameters need to be specified: method: "POST" headers: "Accept": ...


2

Instead of a count column you could have multi-value user column. The count of likes is the number of values in that column. So if the users ID is in the field, he will not be allowed to press like again. Example: $.ajax({ url: URL + "/_api/web/lists/getbytitle('FeedLikes')/items? $select=Title,Users/ID&$expand=Users/ID" ...


0

Changed option select, now working $('#test') .append($("") .attr("value",taskItem.Tabn) .text(taskItem.Tabn)); },


0

Thanks to @DylanCristy for the hint. To solve my problem, I've added «CreateDateTime» to the mapping of the «Created» property: I reset the index, run a full crawl and it works! <d:element m:type="SP.KeyValue"> <d:Key>Created</d:Key> <d:Value>2012-03-09T19:30:00.0000000Z</d:Value> ...


0

I got solution to my question. After Updating the itemProperties i had get resolved of my issue. Updated Code. var itemProperties = { 'Title': userAccName, 'BusinessJustificationForAccessValue': busJust, 'ExpiryDate': expDate, 'PermissionTypeValue': 'Add' }; When i browse my list with REST URL(http://xyz:5000/sites/n/_vti_bin/listdata.svc/L2) in browser ...


0

I did some more investigating and copied a working header, then posted its url side by side and found it almost immediately, should stand out! _api/SP.AppContextSite(@target)/web/lists/getbytitle /_api/SP.AppContextSite(@target)/web/getfolderbyserverrelativeurl leading / is not supposed to be there :|- Hope that helps someone.


0

I just needed to grant the app read permissions to the user profiles.


0

This is most probably because you created the columns in your custom list using the grid view, correct? When you do this, SharePoint assigns these kinds of internal names to your columns, ym4b and rq0x etc. Your 'new' API call is returning with the internal names of the columns. Your 'old' API call is returning with neither the display nor the internal ...


0

Those are the type of randomized names SharePoint generates when you create columns using the "Add Column" button in the "Edit this list" view. You see this differently in the new _api endpoint than in listData.svc because the _api endpoints use internal names and listData.svc endpoints use display names for the JSON data member names. You can avoid these ...


0

No, because (deep down) in the SQL database it is one text-field NOT an Array. REST, JSOM, CSOM, Powershell all write one value to this text-field. There is no logic in between that handles pop/push


0

I could not find an answer to this question anywhere on the internet. Eventually, I was forced to create my own pseudo thesaurus. The SharePoint Thesaurus ended up being just too limited in its use.


0

As explained before, but I will summarize it in here, the user of the workflow can't make REST calls to other sites or subsites by default, you should give the sites and subsites the permission to the workflow to make those calls. To be able to do it, first Allow your workflow to be used as an App by activating the feature Workflow can use app permissions ...


0

If the users have sufficient permissions you can use webinfos. But sometimes users do not have access to some of the subsites. Then SharePoint pops up the login prompt and the call does not work (401 error). In this case you have to use /_api/web/Webs and set effectivebasepermissions in the query string. I have written a relevant post here ...


6

Your code needs two changes to work with both SharePoint On-Prem and SharePoint Online. First, change the type of the second parameter from NetworkCredential to ICredentials. Second, you need to add a header value to the request. private static string GetFormDigestValue(string siteurl, ICredentials credentials) { string newFormDigest = ""; ...


1

Am I crazy or should you need Get, not Post? url: query, method: "POST", headers: {


0

Do you use Javascript to send "Like"? At this case you could use JSOM to set likes: <script type="text/javascript"> SP.SOD.registerSod('reputation.js', '/_layouts/15/reputation.js'); SP.SOD.executeFunc('reputation.js', 'Microsoft.Office.Server.ReputationModel.Reputation', function () { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', ...


0

You are getting this error since SP.Folder resource does not expose Approve method (the list of methods for SP.Folder resource are listed here) You could consider the following solution to approve folder: function approveFolder(webUrl,folderUrl,comments){ var endpointUrl = webUrl + "/_api/web/getfolderbyserverrelativeurl('" + folderUrl + ...


0

try this... replace this data: JSON.stringify({ query: { __metadata: { type: "SP.CamlQuery" }, ViewXml: "<ViewFields><FieldRef Name='FileLeafRef' /> <FieldRef Name='Title' /> </ViewFields> <QueryOptions> ...


0

using jquery: function disable(){ $("#savebutton").prop("disabled", true); setTimeout(function(){ $("#savebutton").prop("disabled", false); }, 3000); } using javascript: function disable(){ document.getElementById("savebutton").disabled = true; setTimeout(function(){ document.getElementById("savebutton").disabled = false; }, 3000); ...


0

To upload a file to SharePoint from C# code, the best is to use the client-side C# API of SharePoint. This only requires to add two DLLs as references to your Web app project (Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll). Examples of usage to upload files: http://stackoverflow.com/a/9849835/3439544 ...


0

You realize you are using multiple asynchronous functions? I believe that if you stop to perform asynchronous loops within other asynchronous loops, you will laugh solve your problem. I suggest that every asynchronous loop you call a function passing the data to the same continuity to the process. Ride your table only after all finalized loops, so you will ...


0

Sounds like you want to create a custom web service endpoint. I followed this tutorial to extend the REST api in one of my projects. Note that you must use the /_vti_bin/ path to access the endpoint when calling it from an app/add-in, the usual /_api/ does not allow non-sharepoint endpoints.


0

You could consider at least two options to rename a file. Option 1. Rename file name You could update the name of the existing list item as demonstrated below Example function rename(webUrl,listTitle,itemId,fileName){ var endpointUrl = webUrl + "/_api/web/lists/getbytitle('" + listTitle + "')/items(" + itemId + ")"; return executeJson(endpointUrl) ...


0

So a couple of things you are going to need to do here is to make sure you get the form digest before you can update the list. To find this information take a look at Wictor Wilen's blog. In the section under "How to refresh Token" you can see how to get the form digest. Once you have that, you need to update the list item. It's pretty straight forward. ...


1

set Ajax property async : false Setting async to false means that the statement you are calling has to complete before the next statement in your function can be called. If you set async: true then that statement will begin it's execution and the next statement will be called regardless of whether the async statement has completed yet.


-1

I have added async: false, to code and it worked request2 = $.ajax({ async: false, url: "URL", type: "POST", data: JSON.stringify({ '__metadata': { 'type': 'SP.Data.XYZListItem' }, 'Title': data.d.results[k].Title}), headers: { "accept": "application/json;odata=verbose", ...


2

You need to look at promises the ajax call returns a promise you can keep them in a array and use jquery's when method to execute once all promises have been run to completion. (Btw this is not really a SharePoint question, but a jquery or javascript question, that have been asked several times before on stackoverflow, so you can see a lot of examples ...


0

Try /_api/web/SiteUserInfoList/Items/?$filter=Id eq 1


2

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


1

Instead of pointing at /SiteAssets/mydata.txt I pointed at /_api/web/GetFolderByServerRelativeUrl('/SiteAssets')/Files('mydata.txt')/$value and used these headers: Accept: application/octet-stream Content-Type: application/octet-stream X-RequestDigest: <obtained in an earlier request> I was then able to process the response (which I left as JSON) ...


0

The Accepted solution has the best approach in it, which is make a call to a default home page at first so user is promoted with authentication screen, after authentication do a redirect to you HTML5 App. In a similar scenario i adopted a different approach, created a Proxy Service with c# which would do the authentication to SharePoint, could be accessed ...


1

I believe RequestExecutor uses method in place of type and body in place of data. It will also insert the digest for you, so you do not need to specify that. I don't recall if it accepts contentType; I usually stick it in with the headers. Try the following: executor.executeAsync({ url : query, method : "POST", body: ...


0

SharePoint doesn't provide a facility for securing individual columns, I mean OOTB. The lowest level SharePoint operates at is security on a whole list item. We can modify the NewForm.aspx or EditForm.aspx or DispForm.aspx to restrict certain columns to be read only or hide by checking permissions with the help of ECMA script and JQuery. Another possible ...


1

The following example shows how to retrieve all of the files in a folder. url: http://site url/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/Files method: GET headers: Authorization: "Bearer " + accessToken accept: "application/json;odata=verbose" or "application/atom+xml" Does this help? Source


1

If you want to use a REST API call each time an item renders you would need to return some concrete HTML element that your async call could later come modify -- using roughly the same solution as identified in this question: Client Side Rendering with Async dependencies Right now, you aren't returning anything from the prepareTextFieldValue function. A ...


-1

In SharePoint to make cross domain calls, you need to create request using SP.RequestExceutor.JS see the below MSDN links SP.RequestExecutor Access Data from Cross Domain


0

Still this no API for retrieving all user profiles You can get current user's profile _api/SP.UserProfiles.PeopleManager/GetMyProperties Or a particular user's profile by login name /_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|xx@siteurl.onmicrosoft.com' BUT You can get available user profiles in a site ...


0

This is the endpoint that serves a list of all users in a site: /_api/Web/SiteUsers Here is the UserCollection resource reference: https://msdn.microsoft.com/en-us/library/office/dn531432%28v=office.15%29.aspx#bk_UserCollection Here is the overall REST API endpoints' reference: https://msdn.microsoft.com/en-us/library/office/dn499819.aspx


0

I have only the permission to view the source list, but not editing. And I can create new lists in the destination site. And yes, this should be a process, in order to have data from multiple source lists, that gets automatically transmitted to my destination list.


1

If you're not going to use InfoPath then you're definitely going to be looking at creating a custom form using HTML and some other custom logic to do the submission for you. The lowest barriers to entry will be JavaScript on the client, or C# in a provider hosted Add-in or server solution. I strongly recommend you consider JavaScript (REST or the JavaScript ...



Top 50 recent answers are included