Accessing sharepoint REST api using S2S authentication
Hi, I'm trying to access the SharePoint REST APIs (One-Drive for business) using the access token retrieved from S2S authentication flow (https://msdn.microsoft.com/en-us/library/azure/dn645543.aspx).
Currently, I'm getting the following exception:
he server was unable to process the request due to an internal error. For more information about
the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the
Microsoft .NET Framework SDK documentation and inspect the server trace log
Is this scenario (app auth instead of delegate auth) support for those set of APIs?
Thanks
Hi,
According to your description, my understanding is that you want to access SharePoint Online One-Drive for business API using OAuth 2.0 authentication.
In summary, Rest API can work with OAuth 2.0 authentication.
Here are some detailed articles about access Rest API with OAuth 2.0 authentication:
OAuth 2.0 Compliant REST API
Securing RESTful Web Services with OAuth2
About accessing One-Drive for business with Rest API, you can refer the article below:
Access OneDrive for Business using the SharePoint 2013 APIs
About the error message, I suggest you can use Fiddler to track the web request to find detailed message:
Fiddler
Thanks
Best Regards,
Jerry Guo
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]
Similar Messages
-
Return data is null while calling Exchange Online rest api using jquery on Chrome and Mozilla
Hi,
I am developing a SharePoint hosted app in which I am calling Exchange online rest api using basic authentication to get mail for the user. This works fine in IE but returns null data when opening in Chrome or Mozilla.
Is there something I am missing while making rest call to api?
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. Thanks, AjeetHi,
This forum is to discuss problems of Office development such as VBA, VSTO, Apps for Office .etc. But I think your question is related to app for SharePoint. I suggest you posting it in
App for SharePoint forum for more efficient responses.
Thanks.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
SharePoint REST API and Asset Library Problem
Hi dear friends,
Im having an issue about posting videos via rest to asset library and i couldnt solve yet.
My main task is to migrate a content(according to the scenario its video) from one farm to another.For that i've planned to use Rest API using server side(c#).While
any other kind of document types(images,texts) are migrated successfully,videos are giving me hard time.
I think theres something special going on while creating videos in an asset library,right?
When i post video as byte array it creates video as .mp4 file but the content type displayed as "Image".I followed this guide : https://msdn.microsoft.com/en-us/library/office/dn292553.aspx and
couldnt find a way.
Can someone give me a sample code or help me solve this issue? Looking forward help from SharePointers who worked with rest api :)
ThanksYou can look at this link to help you set the metadata using REST.
http://sharepointfieldnotes.blogspot.com/2014/04/uploading-documents-and-setting.html
Blog | SharePoint Field Notes Dev Tools |
SPFastDeploy | SPRemoteAPIExplorer -
AD Groups not being resolved in SharePoint 2013 that use SAML Authentication (ADFS)
Hi,
I am wondering to see if we can use AD groups to add to SharePoint groups when using SAML Authentication.
Details:
SharePoint Server 2013 - Default Zone with NTLM, extended to extranet zone with SAML authentication only
I used LDAPCP from codeplex http://ldapcp.codeplex.com/ and am able to resolve the users through email address but not the Active Directory security groups.
Any insight on this is really appreciated.
Thanks, SVHi Sunny,
Find the following article with similar issue, please check if it could help to resolve AD security groups in SharePoint.
http://www.sharepointsecurity.com/sharepoint/sharepoint-security/adfs-not-resolving-active-directory-security-groups-in-sharepoint/
Thanks
Daniel Yang
TechNet Community Support -
Problem when selecting PublishingRollupImage using REST API using Javascript ?
Hii Guys,
I am developing a listing page of News using REST, the custom list contains Title, PublishingRollupImage, and other fields which is provided in the $select
http://xyz/_api/web/lists/getbytitle('News')/Items?$select=Title,Link,PublishingRollupImage
the column "PublishingRollupImage" is there and i can return the result by using normal JavaScript API with CAML query.
but REST calling while specifying this column is failing with this error
The field or property 'PublishingRollupImage' does not exist
Microsoft.SharePoint.Client.InvalidClientQueryException
please note that this is not the (hyperlink/image) field,
its an existing site columns (publishing image)Hi,
According to your post, my understanding is that you want to get Rollup Image data using REST API.
Per my knowledge, we can’t get it using REST API.
We can use Client Object Model to achieve it, the following code snippet for your reference:
var ctx = new SP.ClientContext();
var items = ctx.get_web().get_lists().getByTitle('Pages').getItems(new SP.CamlQuery());
ctx.load(items);
ctx.executeQueryAsync(function() {
// Get the first items rollup image, just as an example
var rollupImage = items.getItemAtIndex(0).get_item('PublishingRollupImage');
console.log(rollupImage);
If you still want to use the REST API, we can customize a We Service to achieve it.
http://sharepointlearningcurve.blogspot.in/2013/08/creating-wcf-rest-service-for.html
Here is a similar thread for you to take a look:
http://sharepoint.stackexchange.com/questions/46844/how-to-get-publishingrollupimage-for-page-in-page-library-with-rest-and-jquery
Best Regards
Dennis Guo
TechNet Community Support -
Sharepoint REST api - subtask filtering
Hi - I am using REST to retrieve the contents of a sharepoint list (via ODATA)
However, the results I am getting back include not only tasks but also subtasks - how can I filter out subtasks, as I'm not interested in them? Thanks!Hi,
According to your description, my understanding is that you want to get only parent tasks using Rest API.
In the task list, there is a field named "ParentID" to distinguish the task and sub task, if the field is null then it is the parent task.
http://<sitecollectionpath>/_api/Web/Lists/getByTitle('TaskListName')/Items/?$filter=ParentID eq null
Here is a similiar thread for your reference:
Tasks and SubTasks with CSOM
More information:
Querying a SharePoint 2013 Task List Rest Api
Thanks
Best Regards
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Sharepoint REST API - Bug in Sharepoint
Hello,
I found bug in sharepoint, where I can submit this bug or get answer from Microsoft about bug?
Description:
Open web appilication properties (Authentication Providers -> Default -> Anonymous Access -> check check box Enable anonymous access)
Create any new site collection(http://myWebpplication/sites/NewSiteCollection) in this web application (don't change any settings in new site collection)
Open fiddler and try to create following Get request without any additional headers.
http://myWebpplication/sites/NewSiteCollection/_api/Web
Now you get following error:Unfortunately, this needs to be reported through Product Support (PSS)... there is no guarantee that it'll get addressed, or when that might happen.
Scott Brickey
MCTS, MCPD, MCITP
www.sbrickey.com
Strategic Data Systems - for all your SharePoint needs -
I am trying to invoke the SharePoint Rest Api using HTML page. I have included the Access Control Allow Origin to the web.config file. I am getting Readty State 4 and
Status Success but still I am getting the below error.
Refused to execute script from 'http://<server>/_api//web/lists?callback=jQuery172045857910416089_1430217181282&_=1430217363882' because its MIME
type ('application/atom+xml') is not executable, and strict MIME type checking is enabled.
<script>
$(document).ready(function () {
$("#KMPDiscussions").click(function () {
//$.support.cors = true;
$.ajax({
url: "http://<server>/_api//web/lists",
dataType: "jsonp",
type: "GET",
method: "GET",
contentType: "application/javascript",
headers: {
"content-type":
"application/json;odata=verbose",
"accept": "application/json;odata=verbose",
success: function onSuccess(data) {
alert("Inside Alert");
error: function onError(data){
alert("Error: "
+ data);
</script>
It always hits the error on callback.
Is there any other way that I can invoke SharePoint Rest Api from a Cross Domain. Please Help.Hi Chris,
Thanks for the reply,Here iam using different files to be uploaded in library.
please find the below snapshot of json response and ULS logs.
12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files
abq2i High Could not get DocumentContent row: 0x80004005. 79f7629c-4694-c026-
3349-2049178ee919
12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files
aiv4w Medium Spent 0 ms to bind -1 byte file stream 79f7629c-4694-c026-3349-
2049178ee919
12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files
aise3 Medium Failure when fetching document. 0x80070012 79f7629c-4694-c026-
3349-2049178ee919
12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x0D4C SharePoint Foundation
Database ab1a9 High Failed to get document content data.
System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function at
Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres)
79f7629c-76ab-c026-3349-2c9132b13e9a
12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x4184 SharePoint Foundation
Database ab1a9 High Failed to get document content data.
System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function at
Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres)
79f7629c-76ab-c026-3349-281167b6cd09
Thanks again,
Naresh. -
HTTP 403 while using SharePoint Online REST API anonymously
Hey Team,
While using REST API to get list items (SharePoint Online) anonymously, I am getting HTTP 403 error:
Request: http://server/site/_api/web/lists('guid')/items?$select=Title,Products/Name&$expand=Products/Name
Response: HTTP 403 : System.UnauthorizedAccessException : Access denied. You do not have permission to perform this action or access this resource.
Authenticated users do not face this issue. The list has anonymous access (View) enabled. Anonymous users can access the lists without facing any issue.
I am not sure and could not able to find any link that says anonymous users can't use REST API to get SPListItems. Any input in this regard will be highly appreciated.
Regards,
Sanjay
Either you love IT or leave ITHi,
From this documentation from MSDN about
Reading data with REST, “Note that you cannot obtain an access token from code that is running on a browser client. You must obtain the access token from code that is running
on a server”, it will only allow the authenticated users who has an access token to access the REST API.
The two links below will provide more information about authentication in SharePoint 2013:
http://msdn.microsoft.com/en-us/library/fp142382.aspx
http://msdn.microsoft.com/en-us/library/jj687470.aspx
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they
help and unmark them if they provide no help. If you have feedback for TechNet
Subscriber Support, contact [email protected]
Patrick Liang
TechNet Community Support -
Performance issue during SharePoint list data bind to html table using Ajax call(Rest API)
Hello,
I am having multiple lists in my SharePoint Site. I am using SharePoint REST APIs to get data from these lists and bind a HTML Table. Suppose, I have 5 lists with 1000 records each, I am looping 5000 times to bind each row(record) to this html table. This
is causing performance issue which is taking a very long time to bind.
Is there any way So that I can reduce this looping OR is there any better approach to improve the performance. Please kindly Suggest. Thank you for your help :)
Warm Regards,
Ratan Kumar RachaHi Racha,
For handling large data binding in a page,
AngularJS would be a great option if you might would worry about the performance.
You can get more information about using AngularJS from the two links below:
https://www.airpair.com/angularjs/posts/angularjs-performance-large-applications
http://www.sitepoint.com/10-reasons-use-angularjs/
Best regards
Patrick Liang
TechNet Community Support -
Retrieve SharePoint Choice Field and Bind to a Control Using REST API
Hi,
I need to retrieve SharePoint choice field values and insert them in a html drop down field on the fly using SharePoint REST API. I wonder if this would be possible - please provide some code/blogs that must have achieved this already.
Thanks n advance.This post will help you
Reference
http://www.learningsharepoint.com/2010/07/24/get-choice-field-values-using-client-object-model-sharepoint-2010/
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/00acd5e9-ad78-4933-a3d2-31e2261aff68/get-the-choices-from-a-choice-field-using-javascript-client-object-model
Regards,
Sairam Avacorp Technologies -
Sharepoint break REST API connection (anonymous), possible bug in sharepoint
Hello, I have following problem when I test Rest API using fiddler :
As i see, server just close connection and does not return any status code at all. I expect to see at least 401 or 500 exception. Is that SharePoint
bug, or this is expected behavior of the SharePoint? (according HTTP protocol & according SharePoint Rest API )
Web application settings and site collection settings:Hi,
Can you access the site from browser?
If you can, would you mind providing more details about how you execute your request? Anonymous or with credential?
How about setting the “Anonymous Access” to “Anonymous users can access Entire Web site”? It would allow anonymous users access the site.
Feel free to reply if the issue still exists.
Best regards
Patrick Liang
TechNet Community Support -
Audit usage for REST API in SharePoint 2013
Hi,
Is there any OOB way for SharePoint to log access in REST API so that it will track which application/user uses the REST API?
Thanks,
KennyHi,
According to your post, my understanding is that you wanted to audit usage for REST API in SharePoint 2013.
Per my knowleadge, there is no out of the box way to accomplish this with SharePoint.
SharePoint 2013 introduces a Representational State Transfer (REST) service that is comparable to the existing SharePoint
client object models.
This means that developers can perform Create,
Read, Update, and Delete (CRUD) operations from their apps for SharePoint, solutions, and client applications, using REST web technologies and standard Open Data Protocol (OData) syntax.
More information:
REST API reference and samples
Thanks,
Linda Li
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Linda Li
TechNet Community Support -
Can we upload any Content Assets using Rest API or Limited?
Hi,
Wanted to understand... based on Component Library, what type of Assets/Content we can upload in Eloqua (E10) before we plan for resources. (images, Hyperlinks, Field Merge, Shared Content, Dynamic Content, Signature Layout, Signature Rule)?
I understand Email Headers and Footers are already included.
Thank You
Amit PandyaHi rkrawat it would appear that you can only access images via the REST API using E10. See this chart for more info Eloqua API Chart
-
Is there any REST API to get all the Site and site Collections from Sharepoint Online
Hi,
I have one SharePoint Online tenant. We are using REST API to integrate SharePoint to our internal System.
For my use case I need to get all the SharePoint sites ans Sitecollections. From each SiteCollection I need all the subsites under this.
I have used below REST Query
http://<Base site url>/_api/web
This doesn't give me all the Site collections
Could any one please give me some way to get all the Site collections and sites from my sharepoint tenant through REST API.
Thanks,Hi Abhiram,
There seems no such endpoint in SharePoint REST API can retrieve a list of site collections in a SharePoint Online tenant:
https://msdn.microsoft.com/en-us/library/office/jj860569.aspx#Reference
If Client Object Model can be an option for you, you can use Tenant object to achieve what you want:
http://social.technet.microsoft.com/wiki/contents/articles/24050.perform-basic-admin-operations-using-csom-in-sharepoint-online.aspx#Scenario_3_Fetch_All_Site_Collections
Anyway, I would suggest you submit a feedback to the Office Developer Platform if there any expectation about the future version of REST API of Office 365 SharePoint
Online:
http://officespdev.uservoice.com/
It
is a place for customers provide feedback about Microsoft Office products. What’s more, if a feedback is high voted there by other customers, it will be promising that Microsoft
Product Team will take it into consideration when designing the next version in the future.
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]
Maybe you are looking for
-
I cannot open Firefox at all... receive "Profile Missing" -- what next?
MAC desktop being used. When I click on my Firefox app it looks and looks then brings up a window: Profile Missing. Obviously, I cannot do much without opening Firefox. What do I do next?
-
Sort photos in album in iCloud Photo
I have created an Album and added photos to it, but the order appears random. Is there a way to reorder/sort the photos by date? Like in the moments view. Thx,
-
Dear Experts, In FBZP, we have house bank and bank determination. In vendor and customer master data, sap also have bank account data. Is there any relationship between bank account data in both of them? We have cases that bank subaccount in FBZP (ba
-
Is there a way to load in spaces using Sql*Loader given that the table it is loading to has a not null column but has a default value. My data file has spaces for a number field instead of zeros. Since my table column is declared as not null, it's fa
-
Hullo, here BB users. My son fixed up my e-mail account on my Q5 last week (bit complicated for me, owing to the ISP we use. Anyhow, it works perfectly except for one thing, it deletes my e-mails after just one day. My previous BB (a curve) used to