Tag Info

New answers tagged

0

You could query the user information list for this. http://your-site-name/_vti_bin/ListData.svc/UserInformationList(userid)


0

You probably want this query: /_api/web/getfolderbyserverrelativeurl('<url>')/Files?$expand=ListItemAllFields It will return files properties along with associated list item properties.


1

Some how I figured out the way of using deferred and promises in correct manner. Following code runs perfectly as required. function upload() { // Define the folder path for this example. var serverRelativeUrlToFolder = 'SiteAssets'; // Get test values from the file input and text input page controls. var fileInput = jQuery('#getFile'); ...


0

Look at http://paulryan.com.au/2014/spo-remote-authentication-rest/ It works for me (if I get you right). Just ignore stuff about digest - put mentioned 2 cookies into your header as Cookie:c1;c2 where c1 and c2 are authentication cookies (ones starting from FedAuth= and rtFa=).


1

Try putting extra apostrophe. That is, use Web/getfilebyserverrelativeurl("/Shared Documents/Roy''s quoted doc.txt")


4

Use _spPageContextInfo.siteAbsoluteUrl for getting the site collection url. For more info, refer : http://blah.winsmarts.com/2013-2-_sppagecontextinfo_is_your_new_best_friend.aspx


1

You can use: 1. /_api/web/GetFolderByServerRelativeUrl('/LibraryName')/files. If this is not working for you, check the relative URL is correct. For eg: for a site collection starting with /sites/siteColl, relative URL would be /sites/SiteColl/SitePages. Also, navigate to the library to check the correct URL. 2. /_api/web/lists/getbytitle('LibName')/items ...


2

Some options to do this: Use Listdata.svc: http://SiteURL/_vti_bin/listdata.svc/UserInformationList. This returns all the items. Use $top=5000: http://SiteURL/_api/Web/SiteUserInfoList/items?$top=5000. This will return all items within the threshold limit. Use GetItems This is a POST request where you can use an empty CAML query to return all the items. ...


0

Remove the semi-colon from your jquery definition tag. It should look something like: <script src="//code.jquery.com/jquery-1.11.3.min.js"></script> Text between tags that should reference external scripts will mess things up.


0

You could disable the "SharePoint OpenDocuments Class" add-on in IE. In chrome this is already disabled since chrome did away with npapi. In Firefox you can disable the "Microsoft Office 2010" plugin - the one that says "This plugin allows you to open and edit files using Microsoft Office Applications" You will want Office Web Apps set up before you do ...


0

Interestingly, this issue has been resolved. I removed an unused field and it started to perform as is used to perform. However, I am not sure why deletion of a random file resolved the performance problem. I would love to tell the reason, but I really do not know. I am also not sure whether my answer is a real answer..


0

You could use the Managed Property SiteTitle in your display template in order to show it. You could specify the managed properties you want to retrieve with the selectproperties parameter: _api/search/query?querytext='your+keywords'&selectproperties='SiteTitle'


0

You cant connect to an other SharePoint-Site than the local one using JSOM. The Reason it internally connects to the SharePoint-Services of your current Site and then tries to find the Site on that Server, which is not the case. You could try accessing the Remote-Sites Rest-Webservices using plain Javascript, but you have to enable ...


0

Thats a security Feature of modern Browsers. You can´t do a Request to another Domain using Javascript. The only Thing you could to is to add a "Access-Control-Allow-Origin" Header to the Webservers (SharePoint) Response. However, if you do not have this possibility, there is no way.


0

Assuming you are using JSOM First you need to create object of SP.RequestExecutor() Than you can call cross domain url by using executor.executeAsync() For more info follow this For example: $.getScript(scriptbase + "/_layouts/15/SP.RequestExecutor.js", myFunction); }); //scriptbase -- > your host web url, which can be fetch from query string ...


0

Auditing for Opening or downloading documents, viewing items in lists, or viewing item properties is not available for SharePoint Online in Office 365 for enterprises.


0

I got a similar issue in my tenant after an update from MSFT. The Query used to work for all users,But worked only for Site Collection Admins after the update. The issue in my case was having an empty Where Condition in my Caml Query <View><Where></Where><OrderBy>........</OrderBy></View> I removed the Empty Where ...


0

So the correct answer for me is added in the original post. I added the ?&expand=Properties to the URL - which expanded the properties inside the same request. I then had to update my (Java) classes that represent my JSON data to reflect the same changes. Note that I did use JSON in my responses rather than XML as above mentioned.


2

As mentioned here in MSDN, There are two functions in SP to get the properties getUserProfilePropertiesFor // for multiple properties, not availablee in REST GetUserProfilePropertyFor // for single property MSDN documentation has clearly stated that the "getUserProfilePropertiesFor" method is not implemented in REST (search for ...


0

It depends on where you are reviewing the results. If you're building the URL in the address bar of a browser, the results WILL NOT necessarily be sorted by the orderby parameter. That is because the "Displaying" section on the right side of the Atom feed results, in the browser, takes over. You can actually sort it right there on the screen by clicking the ...


1

You need three additional headers: "X-RequestDigest":"value" A unique security token to validate your requests. "X-HTTP-Method": "MERGE" To indicate that you're performing an update "If-Match":* To handle concurrent requests. This actually has 2 values viz. item.__metadata.etag representing the actual item tag and * to handle any value. As an example ...


0

I've never done that before but with a little googling I found something for you: http://www.lavinski.me/calling-a-rest-json-api-with-powershell/ This works so far with Powershell: Invoke-RestMethod -Uri "your REST URL" -UseDefaultCredentials otherwise you would need to specify your credentials directly.


0

If I understand you correctly you just need a column that contains a link to each attachment that that item has. An easy way is to do it via jquery and then attach it to the list. Answer taken from ...


2

Although I couldn't find a way to retrieve the custom user profiles by using the user profiles REST api since the properties are returned in an array and AFAIK no existing method exists to filter them from the URL but since some of the OOB user profile properties are stored to the user information list, you can maybe try this: var userId = ...


0

You can try this instead: /_api/Web/Lists/GetByTitle('Document Library')/Items?$expand=File This will not only retrieve the file properties, but the list item properties as well.


0

you can use JSOM to like an Item var setLike = function (context, listId, itemId, isLike, likescount) { SP.SOD.executeFunc('reputation.js', 'Microsoft.Office.Server.ReputationModel.Reputation', function () { Microsoft.Office.Server.ReputationModel.Reputation.setLike(context, listId, itemId, isLike); ...


1

Try http://site/_api/web/currentuser. This should return the current logged in user that is used to send the REST query.


0

If you want to get user profile properties for a current user via REST API, then you can either pass user id and get all properties including your own custom or use method GetMyProperties. Code where you pass userId. userInfo.UserProfileProperties.results[10] is a bit of code where you get available user profile properties. If I am not wrong then custom ...


0

<html> <head> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> var followingEndpoint; var URL; var website; var clientContext; SP.SOD.executeFunc('sp.js', 'SP.ClientContext', loadWebsite); function loadWebsite() { clientContext = ...


1

If you want to get only the specific property value then use "getuserprofilepropertyfor" & pass the current user login name $.ajax({ url: "http://<site url>/_api/sp.userprofiles.peoplemanager /getuserprofilepropertyfor(accountName=@v, propertyname='Office') ?@v='i%3A0%23.f%7Cmembership%7Csekhar%mydomain.onmicrosoft.com'", ...


0

It is definitely a mess but I figured it out. I decided to just use a app property eventually and make the user enter the url, but here's the answer for the above. var blogUrl = appUrl + "/_api/site/rootWeb/webinfos?$filter=(WebTemplate%20eq%20'BLOG')"; That will get all the blog sub sites and from within that you can iterate through and get all the ...


0

Not enough Reputation to add a comment, but DacrioS has cracked it. I have an on-premises install of Sharepoint 2013 and could not get attachments to show up when using _api/web REST interface. Until I read this comment: "Try adding Attachments to the select." Let me be clear: This Does Not Work ...


0

You can use the ADAL library to Authenticate with AZURE https://msdn.microsoft.com/en-us/library/azure/dn151135.aspx https://github.com/AzureAD/azure-activedirectory-library-for-js http://www.cloudidentity.com/blog/2014/10/28/adal-javascript-and-angularjs-deep-dive/


0

You can use this code for updating Text,Number,Lookup,Content Type,Single Select managed Metadata columns fields using REST API: item = { "__metadata": { "type": "SP.Data.ABCListItem" }, "Title": "Name", "Name": "Name field", "PId": 736, "short": "short desc", "long": "long desc", "category": "High", "status": "New", ...


0

Andrew Connell covers the solution to this very thoroughly in his blog here: http://www.andrewconnell.com/blog/Applying-Filters-to-Lookup-Fields-with-the-SP2013-REST-API


1

I know this question is old but it might help someone doing Research on this. I recently wrote a script to figure out access rights and found something that might help. Here is a simplified Version from the object model to illustrate what i mean: Web -----> RoleAssignments -----> Member -------> ...


0

I think I know what you mean, but there may not be that much general information out there (there was not when I was looking) I started with this handy blog and went from there, maybe it will help you get a better understanding - Create subsite with call HTTPS web service


1

b1c10's answer is probably on the right track, stating that the problem might be on the file input, try to check if you actually upload the correct stream to the REST API. If the stream is already corrupted before the actual upload, it has nothing to do with your POST. Try to convert your stream back to the original file locally and see what that tells you. ...


0

below query finally worked for me Merged is a calculated field in Cats list Cat is a lookup field(which looks above Merged column) in the MainFlat list "?$select=Title,number,Cat/Merged&$expand=Cat" + "&$filter=Cat/Merged eq '"+Merged+"' "


0

You can use the next code: $(function() { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', CopyFile); }); function CopyFile(){ var oUrl = _spPageContextInfo.webAbsoluteUrl +"/_api/web/getfilebyserverrelativeurl('/Library/acento.txt')/copyto(strnewurl='/Lybrary_2/acento.txt',boverwrite=true)"; $.ajax({ url: ...


0

You can use ISO 8601 format (YYYY-MM-DD) for dates. The following will work: 2015-08-11 2015-08-11T12:40:16Z If you are in chrome, using a date input (<input type="date" />), then it will always return it in ISO 8601 format. If not, and you're using a JavaScript library to create a datepicker control, then check if they have a format options. ...


1

Question resolved. The error message is completely misleading. It has nothing to do with the token - the problem lies within the strict POST message format SharePoint is requiring. If you use the following headers for your POST request, everything works fine. headers = {'X-RequestDigest': token, 'Accept': 'application/json; odata=verbose', ...


0

To create List item using Rest call, you need to do the following: 1) Set the metadata properties as- var item = { "__metadata": { "type": itemType }, "Title": newItemTitle }; 2) Ajax call: $.ajax({ url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items", type: "POST", ...


2

To get the default values of columns you first need to get the columns and then use the get_defaultValue() method to get the default value. this.list = webSite.get_lists().getByTitle("ListTitle"); this.fieldCollection = list.get_fields(); this.field = fieldCollection.getByTitle("FieldTitle"); Once you get the field you can use the below code to find the ...


0

Images are not indexed by default unless you put them in Picture Libraries. You can test this by querying FileExtension:jpg. Videos depend on how you uploaded them. If you are using the SharePoint Video content type, excluding .aspx may be your issue. What happens when you search for ContentType:Video? On-Prem you can change the files indexed, you cannot in ...


0

The problem is, that the code in the background changes the document in SharePoint, so word will inform you that there is a newer version. The same thing happens if you have a EventReceiver on the DocumentLibrary, that would make changes to the document upon document updates. Have you tried explicitely checking out the document before starting to work with ...


0

Theoretically, according to this MSDN page it should be possible: https://msdn.microsoft.com/en-us/library/office/dn292556.aspx However, I have yet to figure out what to send in as the first 2 parameters (context, web). The request should look something like this: ...


0

Thanks everyone for your responses I realised that a CSWP would be good idea after reading your responses. I gave this a try and removed the filter of assigned to Custom task display template which pulled all tasks from subsites of my root site and made the look and feel better. All I need to do now is try and group by project but feel that is a ...


0

To return files use: _api/web/lists/getbytitle('Documents')/items?$filter=startswith(ContentTypeId, '0x0101') To return folders use: _api/web/lists/getbytitle('Documents')/items?$filter=startswith(ContentTypeId, '0x0120') I have tested this against SP2013 Online (O365), it should work against SP2010 as well. This works against all child content types as ...


0

I'm using Powershell and CSOM to do this so there has to be a way to do it in REST I would think. Function Set-GroupOwner{ Param( [Parameter(Mandatory=$true,HelpMessage="The URL of the site collection",Position=0)][ValidateNotNull()] [string]$SiteUrl, [Parameter(Mandatory=$true,HelpMessage="The group that needs ...



Top 50 recent answers are included