Tag Info

New answers tagged

0

You can do something similar as below String req = "http://sp2k13/sites/ifsp/_api/Web/Folders/add('LibraryName/FolderName')" NTCredentials credentials = new NTCredentials(UserName, Password, "JAVA-MACHINE-NAME", "DOMAIN"); HttpClient httpClient = new HttpClient(); httpClient.getState().setCredentials(AuthScope.ANY, credentials); ...


0

there is a similar question on this site as yours. have you gone through that ? question public void createFolder(String digest) throws ClientProtocolException, IOException { HttpPost request = new HttpPost( "http://industrial-ex/sites/tifdemo/_api/Web/Folders/add('enovia/newfolder')"); request.addHeader("Content-Type", ...


2

Try this (Excerpt from here): function getListItem(url, listname, id, complete, failure) { // Getting our list items $.ajax({ url: url + "/_api/web/lists/getbytitle('" + listname + "')/items(" + id + ")", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { // ...


2

The query /_api/lists/getbytitle('<list title>')/items?$select=* returns list items for visible fields only (SP.Field.hidden property is set to false). To be more precise the expression $select=* returns: visible fields values (query that returns visible field names: /_api/Web/Lists/getByTitle('<list ...


1

your first REST query should work as long as internal name of the position column is same. You can check by running below query which will display the metadata for columns along with their columns. http://thisbox/_api/lists/getbytitle('ThisList')/items you will see something like this: <d:User_x0020_ModifiedId ...


0

Not a direct way. Select only responds to the name/GUID. You would have to do an additional pull to http://thisbox/_api/lists/getbytitle('ThisList')/Fields in order to return the list of names, internal names and GUIDs and cross-reference accordingly.


0

I assume it is by design. I can reproduce it if the lookup field can contain multiple references. If it is single lookup column, there is no error.


1

I believe you need to use XMLHttpRequest for this var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if (this.readyState == 4 && this.status == 200){ //this.response is what you're looking for handler(this.response); console.log(this.response, typeof this.response); var img = ...


0

Are you using this code against SharePoint Online / O365 or against an on-premise SharePoint server? AFAIK, the $batch operation is supported only in case of the former ones, see this post: SharePoint Online and the Office 365 APIs implement the OData $batch query option


3

In order to return list url you could utilize List.RootFolder.ServerRelativeUrl property. Some recommendations From performance perspective prefer server side filtering over client side one, the example below demonstrates how to query lists filtered by BaseTemplate: /_api/Web/Lists?filter=BaseTemplate eq '101' Example $.ajax({ url: ...


2

First Add an img element to display Images <img id="imageRotator" > Now use below JavaScript function to get Images var arrayOfImageObjects = new Array(); var currentImageIndex = 0; function GetImagesAndRotate() { var url = "http://siteurl/_api/web/lists/getbytitle('ImageLibrary')/items?$expand=File" jQuery.ajax({ url: url, ...


2

When you create or deploy app to the SharePoint it creates a web of its own(even your app may have list and libraries of its own) so app is nothing but a site in your SP, now when you try accessing the your site from this SP App SharePoint won't allow it due to security reasons, and you may get Access Denied error, So to overcome this you need to make a ...


3

It appears that the list resides in Host web instead of the App web. In this case the app needs to be given permission to read the List of the host web. Moreover, the REST call needs to be done using cross domain library. Example of cross domain call using REST: executor.executeAsync( { url: appweburl + ...


0

The "Accept" dictionary parameter has a "/" character which is being rejected by SharePoint 2013 workflow. You can test this by excluding the "/" character and it should work. In my case a custom password field in a SharePoint list contains a "/" because its encrypted. I was trying to pass the password field to the web service call in the workflow and got ...


1

You could use the following endpoint for getting Folder permissions: /_api/Web/GetFolderByServerRelativeUrl('<folder url>')/ListItemAllFields/RoleAssignments Example The following example demonstrates how to retrieve permissions details including Member and RoleDefinitionBindings info for a Folder and print it: function getJson(url) { return ...


1

Add following to your REST query $select=FileLeafRef


0

Searching for a solution, the only source that seems to provide a full answer is Paul Ryan blog here. The process he describes requires three steps: Get the security token Get the access token Get the request digest for each step he describes the endpoint to call and the info to post. I will try to obtain his permission to replicate the info here to ...


1

A sharepoint app essentially exists in a domain. So you need to either use SP.RequestExecutor.js or use SP.AppContextSite This is the structure of the URL if using SP.AppContextSite var url = appwebUrl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('"+listName+"')/items?$select=Title,ID&@target='" + hostUrl + "'"; This is the general ...


1

This looks like a typical Same-Origin-Policy issue that may be solved configuring CORS on the remote server, and may be worked around proxying the communication between your server and the remote server: put some piece of software in your server that performs the real requests to the remote server. This way, all the calls from your browser will be to the ...


2

Cross domain calls are blocked by modern web browsers due to security concerns. To get round this you can use the SP.RequestExecutor.js script to relay messages to SharePoint from within the same domain. Example function getListItem(hostUrl,appWebUrl, listTitle,itemId,success,error) { var url = appWebUrl + ...


1

AAM was the answer. The starting point is this link


0

In Azure AD add all the permissions that you can off SharePoint. Use this endpoint for list all the folders: https://mydomain-my.sharepoint.com/personal/user_domain_onmicrosoft_com/_api/v1.0/files/{folder_id}/children folder_id = root, for the Root folder This worked for me. also you can get the list of all the sharepoint sites using this query: ...


0

Not sure how it works with authorization, but check this link for how to construct de REST Url: enter link description here Especially the schematic image is very useful.


1

Look this sample from MSDN. Provider-hosted apps written in JavaScript must use the SP.RequestExecutor cross-domain library to send requests to a SharePoint domain. You can upload files up to 2 GB with the REST API. jQuery(document).ready(function () { // Check for FileReader API (HTML5) support. if (!window.FileReader) { alert('This ...


0

Instead of using the REST Api, you might try using PowerShell (which calls the REST API for you, and also takes care of Authentication, see below). Googling "PowerShell and R" will give you lots of ways to do that. To get PowerShell to query lists from SharePoint Online (much harder than for SharePoint On-Premises), do the following: 1.) Install ...


0

Try this sample var call = $.ajax({ async: false, url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('AppointmentInfo')/items" + "?$select=Id,Collaborators/Id, Collaborators/Title,Title" + "&$expand=Collaborators/Id", type: "GET", dataType: "json", headers: { Accept: ...


1

Its should be $select=Collaborators/Title&$expand=Collaborators Example your URL should like http://yoursite/_api/web/lists/GetByTitle('Employee Details')/items("1")?$select=ManagerName/Title,FirstName,LastName,Position,Phone,Fax,PreviousCompany,Reference,BirthDate,Relocate,EmailAddress&$expand=ManagerName


0

If you are looking to grab the first letter of each last name you could use startsWith in your $filter of the query. https://msdn.microsoft.com/en-us/library/office/fp142385(v=office.15).aspx#bk_supported


0

Try using lastname= instead of lastname: Typically in the Search API a : means "Contains" and an = means "Equals" which will anchor the query to the beginning of the line. I'm not 100% certain it works in this specific case but give it a try and let me know. Edit: For reference, here's the KQL guide. Depending on the architecture of your application you ...


0

The problem depends on a lot of details like the authentication configuration of both systems (SP2010 and SP2013) and also the client. If we are talking about Internet Explorer, the authentication is only available within the browser request. That is at least one reason why Microsoft removed the sign in as feature. If you do a sign in as and click on a word ...


0

Don't you have cross-site scripting promlems, when accessing the SP 2013 site from the JavaScript on your SP 2010 page? Regarding your original problem, I inserted the following JavaScript code into a SharePoint 2010 page: $(document).ready(function(){ $.support.cors = true; $.ajax({ url: "http://YourSP2013Server/_api/web/CurrentUser", ...


0

By changing REST to: ('Inlägg')/items?$select=Title,Author/ID,Author/FirstName,Author/LastName,Author/Title,Author/Department,Author/SipAddress&$expand=Author/ID')", And then using: <img ng-src="https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email={{blog.Author.SipAddress}}"/> The picture of the Author of the listitem ...


0

We can't expand the User field to return PictureURL. You need to invoke another Service Call. The easiest option is to query the User Information List "/_api/Web/Lists/getByTitle('User Information List')/items?$filter=Id" eq + blog.Author.ID + "&$select=Picture" This will return SP.FieldUrlValue and you can extract the Url property.


0

At least the following components could be utilized for that purpose: HttpWebRequest WebClient HttpClient You might find this post helpful that demonstrates how to consume SharePoint REST API in .NET, in particular it demonstrates how to: perform authentication in SharePoint Online using HttpClient perform basic CRUD operations using HttpClient ...


1

The following query demonstrates how to exclude system folders: https://site/_api/Web/GetFolderByServerRelativeUrl('<folder url>')/Folders?$filter=ListItemAllFields ne null&$expand=ListItemAllFields SP.Folder.listItemAllFields property is used to determine whether Folder is system or not since system folders are not associated with a List ...


0

I was able to get the filtering working by using datetime prefix in SharePoint Online (Office 365). Here is an example of a REST query that pulls the dates back in a range. _api/web/lists/getbytitle('Expenses')/Items?$filter=Expense_x0020_Date ge datetime'2015-04-06T00:00:00Z' and Expense_x0020_Date le datetime'2015-04-07T00:00:00Z' Here are the ...


2

That may be because the default address is the server name, and your code is run on the server itself. In that case, everything is fine. But if you use another domain name to target the server from the server itself, you may face the "loopback check" feature of Windows Server. You can test quickly by disabling this feature, like mentionned in method 2 of ...


3

You could try the following endpoint: https://server/_api/Web/GetFolderByServerRelativeUrl(<folder url>)?$expand=Folders,Files It returns files and folders beneath folder at the specified url. JavaScript example The following example demonstrates how to retrieve files and folder beneath 2015 folder: var folderUrl = '/documents/2015'; var url = ...


1

You can get all of the documents and folders contained directly under a given subfolder in a document library: /_api/web/Lists/GetByTitle('DocLib')/GetItems(query=@v1)?$select=Title,File/Name&$expand=File&@v1={"ViewXml":"<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='FileDirRef' /><Value ...


2

According to Working with folders and files with REST the following example demonstrates how to create a Folder: url: http://site url/_api/web/folders method: POST body: { '__metadata': { 'type': 'SP.Folder' }, 'ServerRelativeUrl': '/document library relative url/folder name'} Headers: Authorization: "Bearer " + accessToken X-RequestDigest: form ...


1

It is not. The out of the box functionality has a single stack that throws any requests for that asset into the counter. You'd have to do some code to get what you're referring to either on server or client side.


0

Just tested your REST call in my SharePoint 2013 Enterprise environment and it works correctly. Make sure your list has attachments turned on. List Settings>Advanced Settings> Attachments. Set to Enabled. Make user the Title in the url correctly matches a list in your on-prem site.


0

Sahil Malik has Written a blog post on how to "Get list of site collections using CSOM in Office365", It may help you. Below is the code snippet from his blog: var token = TokenHelper.GetAppOnlyAccessToken("00000003-0000-0ff1-ce00-000000000000", tenantAdminUri.Authority, null).AccessToken; using (var clientContext = ...


1

Use the ViewsLifetime and ViewsRecent metadata returned from http://site/subsite/_api/search/query (such as http://site/subsite/_api/search/query?querytext='ContentTypeId:0x010100C568*'). No views is a null value. (in JSON the return looks like) 20: { __metadata: { type: "SP.KeyValue" }- Key: "ViewsLifeTime" Value: "246" ValueType: "Edm.Int64" }- 21: { ...


0

Indeed, the filter expression: $filter=(AuthorId eq <UserId>) does return the error in SharePoint on-premise: Column 'AuthorId' does not exist. It may have been deleted by another user The list of expressions that are supported in SharePoint Online/on-premise: $filter=(Author eq <UserId>) ...


0

Please, see my answer in this thread. As far as I the official documentation of this API, and other samples on the web (like this and this one) understand, the body of the request can be set in this case as a StringEntity instance via the setEntity method of the HttpPost object: String jsonString = "{ '__metadata': { 'type': 'SP.List' }, ...


1

I assume you mean SharePoint 2013. In this case, of course, you can create lists, including document libraries via REST, as described here. For the document library you should use 101 as the BaseTemplate. url: http://site url/_api/web/lists method: POST body: { '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true, 'BaseTemplate': 101, ...


1

How to create a Document library using SharePoint REST: url: http://site url/_api/web/lists method: POST body: { '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true, 'BaseTemplate': 101, 'ContentTypesEnabled': true, 'Description': 'My Documents Library', 'Title': 'Documents' } Headers: Authorization: "Bearer " + accessToken ...


0

This is the bug in Microsoft product. We also faced the same issue for 3 months, then they confirmed us about the bus.


0

below are my final working code for downloading file from REST. var dfd = $.Deferred(); var xhr = new XMLHttpRequest(); xhr.open("GET", filepath); xhr.responseType = "blob"; //setting response-type header to be blob so that we get the file as blob xhr.onload = function () { //async call var blobobj = xhr.response; window.navigator.msSaveBlob(blobobj, ...



Top 50 recent answers are included