Sharepoint Rest API, Get files from a list is throwing unknown 500 errors only when a file is present - sharepoint

CrossPost from the sharepoint SE https://sharepoint.stackexchange.com/questions/299076/sharepoint-rest-api-get-files-from-a-list-throwing-unknown-500-errors-only-when
I've been setting up an app to query a Sharepoint Document list for files (amongst other things). Querying {{mainLink}}sites/{{subsite}}/_api/web/lists/Documents/Files on postman with the following headers works perfectly - so long as no files are present.
The moment I upload and check in a file to one of the folders on this sharepoint directory, I immediately get error 500, "code": "-1, Microsoft.SharePoint.Client.UnknownError"
The moment I delete said file, I can again query the list and get back the folder metadata just fine.
When I test the same code against our internal sharepoint site (the errors are coming from integrating with a client of ours) it works without a single hitch, and now I'm just confused. my guess is that there is some setting on their system or some optional parameter on my postman that needs to be set to make file requesting work properly. My question is does anyone know why the 500 errors are conditionally happening and/or how to fix them?
I also get the same error going through the folder Web/Lists(guid'1234')/files('1234')/Children
I've now discovered that I don't get the errors when going through the relative folder url {{mainLink}}sites/{{subsite}}/_api/Web/GetFolderByServerRelativeUrl('Documents/In')/Files is working fine for some reason. I can work with the one functioning endpoint, but I'd still like to know why all the other perfectly valid requests fail the moment any files are uploaded to the sharepoint site

Related

Get a file from SharePoint Online using Microsoft Graph API

While learning graph API, I was trying to get a file from a SharePoint document library using Microsoft Graph API.
I first tried by accessing files in Documents from https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com
by doing this GET request:
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com/drive/root:/Test:/children
Everything worked great, I then tried accessing documents from another site within the same tenant. I told my self it was the same pathway while following the Microsoft docs.
I first did a test request to be sure i can first access to my site; here is what I did;
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite
On executing that query i got a 200 OK response.
Secondly I then tried accessing the drive Documents here is what i did;
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive
again everything worked fine.
I then used the root relation followed by the name of the directory and then the children relation; and this was my request:
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive/root:/Test:/children
But while executing that, I'm getting Bad Request - 400 - 96ms
Please help.
Thanks
I have the same issue when using site relative url to specify the specific site.
Now I'm using siteId instead and everything works as expected:
https://graph.microsoft.com/v1.0/sites/zheguo.sharepoint.com,91a47a59-db5e-4d17-a689-479ee8905533,274459c9-4c96-42bf-9b96-838ffa387aaa/drive/root:/X:/children

CMIS Workbench Error running Query - Sharepoint 2013

We are trying to run a simple query on a list (Sharepoint 2013) on Workbench but we are getting the "Connection:Redirects are not supported (HTTP status code 302):" error. What's weird is that we can run queries on other list except one named "AP Document".
We have also tried on on Visual Studio but is now getting the "Unauthorized error". With this we had set the permission to all lists to default but am still getting an error. We had also tried deleting the list and re-creating it but still no go.
What are we doing wrong with this one list? Here's a log to check the codes. Please help.
ERROR hemistry.opencmis.workbench.ClientHelper:
CmisConnectionException: Redirects are not supported (HTTP status code
302): Found
org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException:
Redirects are not supported (HTTP status code 302): Found at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:460)
at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:650)
at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:179)
at
org.apache.chemistry.opencmis.client.runtime.SessionImpl$5.fetchPage(SessionImpl.java:887)
at
org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
at
org.apache.chemistry.opencmis.client.runtime.util.CollectionPageIterator.hasNext(CollectionPageIterator.java:48)
It seems that it was a file within the list that was causing the error. When you try to run a query within that list that excludes that file -- everything works fine.
Had to just remove and reupload it to fix the issue. but still curious why that is because the file can still be opened and viewed with no error on sharepoint but is getting the Unauthorize or Connection error when accessed thru CMIS...

Error enumerating empty folder using Office365 API in OneDrive for Business

In the last couple of days I'm experiencing a strange problem with the Office365 API when I try to enumerate the children of an empty folder in OneDrive for Business. It happens both using the latest libraries and when I directly call the REST API:
GET {personal-site-url}/_api/v1.0/Files/{folder-id}/children
If the specified folder has no files and sub-folders in it the call returns with the following error:
{error: {code: "-2147024809, System.ArgumentException",message: "loginNameToIdMap Parameter name: Specified value is not supported for the loginNameToIdMap parameter."}}
Last week the request still worked fine, returning no items for empty folders, but without error. I think this is a critical bug in the system that was introduced lately. I've tried with two separate Office365 subscriptions and the problem can be reproduced in both.
Is this behavior by design or is it really a bug, and is anybody else also experiencing this problem?

SharePoint 2013 REST upload from App works on image, fails on video

Has anyone tried to upload a video via REST to SharePoint 2013 from a SharePoint hosted app?
Below are my two POSTs. The first one, an image, works fine. The second one does add my video but it throws a 404 (Not Found). Subsequent executions do not overwrite but instead create new video files with some random letters afterwards. The subsequent executions also pop the 404.
I should also point out the the overwrite flag is obviously being ignored because it always creates a new file. Further when I tried to use the "manipulated" video URL that you see in a library after uploading it blows with a server error.
My suspicion is that it's because of the way SP2013 handles videos by creating items that don't retain their extension like an image does. Anyone know for sure?
Or know if there's some sort of RESPONSE that is sent back that would cause the 404?
http://app2-6040b7dbcd33cc.sp13apps-qa.PATH/sites/XDevT/CustomNewsFeedEntry/_api/SP.AppContextSite(#TargetSite)/web/lists/getByTitle(#TargetLibrary)/RootFolder/Files/add(url=#TargetFileName,overwrite='true')?#TargetSite=%27http://teamsites13-qa.PATH/sites/XDevT%27&#TargetLibrary=%27NewsFeedVideos%27&#TargetFileName=%27cg-overlay-img.jpg%27
http://app2-6040b7dbcd33cc.sp13apps-qa.PATH/sites/XDevT/CustomNewsFeedEntry/_api/SP.AppContextSite(#TargetSite)/web/lists/getByTitle(#TargetLibrary)/RootFolder/Files/add(url=#TargetFileName,overwrite='true')?#TargetSite=%27http://teamsites13-qa.PATH/sites/XDevT%27&#TargetLibrary=%27NewsFeedVideos%27&#TargetFileName=%27WMV_Movie.wmv%27

Ink File Picker 403 error when accessing files

I have several files uploaded to filepicker (>100) and suddenly I've been getting 403 errors when trying to access them.
The files aren't stored via S3, so that might be part of the problem but it I haven't had issues for months.
When trying to access the file I get the following response:
No longer authorized to read file
I haven't enabled security, and I'm able to access fiels stored in a different filepicker application from months ago (ex: https://www.filepicker.io/api/file/oDm5UsViTYuGCIPD5TGY)
I'm getting the same error when trying to access files from the developer console, I have no idea how this happened.
edit: Apparently this has been happening for the past month!

Resources