How to connect to sharepoint CRM document library with onedrive api? - sharepoint

We have sharepoint online with site CRM.
I use OneDrive SDK for iOS.
I can connect to main document library with onedrive api. I used usefull "github example" to configure it.
resourceId: https://{tenant}.sharepoint.com/
apiEndpoint: https://{tenant}.sharepoint.com/CRM/_api/v2.0
Web URL of this library is:
https://{tenant}.sharepoint.com/CRM/Shared Documents
This configuration is fine and works OK.
I have trouble with another document libraries on this site.
Dynamics CRM creates his own document libraries. For example Acccount.
I can open this library on Web. Browser URL is:
https://{tenant}.sharepoint.com/CRM/account/Forms/AllItems.aspx
But I'm not able to connect to this CRM library.
I tried simple ask for children account:
https://{tenant}.sharepoint.com/CRM/_api/v2.0/drive/items/root/children/account
This API request returns error 404.
I also modified apiEndpoint to:
https://{tenant}.sharepoint.com/CRM/account/_api/v2.0
Result is the same. Error 404 - Not found.
Help me with correct configuration please.

To be precise, your question is regarding SharePoint, not OneDrive or CRM.
Here's a reference to the REST endpoint for SharePoint: https://msdn.microsoft.com/en-us/library/office/jj860569.aspx
If you want the items in an account library, you can use the rest api like this:
https://tenant.sharepoint.com/crm/_api/web/lists/GetByTitle('Account')/items

Related

Using Microsoft Graph Search API in SPFx Web-Part?

I am trying to prototype the use of Microsoft's new MS Graph Search APIs in a SharePoint Framework (SPFx) Web-Part in SharePoint.
While configuring the web-part, I've updated the package-solution.json file to include the needed webApiPermissionRequests (see below screenshot):
However, after deploying the app to the SharePoint app catalog and attempting to authorize the web-part's permissions via SPO Admin Center > Advanced > API access, I am getting the following error:
Is this not yet supported?
Here's the error I see when performing the same approval via PowerShell:
FYI — I tried to use the microsoft-search tag as recommended by MS here at stack overflow, but it does not yet exist and I don't have the reputation here to add it.

Access External List from SharePoint Add-In using REST

I am using the SharePoint REST API inside an Add-In to access list data. When I query a "normal" list, I get results back. When I try to query an External List, I get a 401 error. I get the same error when I try to access the REST URL in the browser:
http://add-in-6f1ecc432fad91.myaddins.com/sites/development/_api/lists/getbytitle('TestExternalList')/items
When I try to access it outside the app it works fine:
http://sharepoint/sites/development/_api/lists/getbytitle('TestExternalList')/items
I read that you can't access External Content Types from an add-In here:
http://toddbaginski.com/blog/accessing-bcs-external-data-from-an-app-for-sharepoint-2013/
So I tried to package my BCS model as per the site and I get the following error:
The Project Item "TestBDC" cannot be deployed through a Feature in a Sandboxed Solution.
So my question is, is it possible to access an External List through an Add-In?
I am using SharePoint 2016.
Sounds like it may be a permissions issue. Do you have the BCS scope set in the app permissions?
Here's an article with info on setting up the security
https://learn.microsoft.com/en-us/sharepoint/dev/general-development/add-in-scoped-external-content-types-in-sharepoint

How to access a document library in a sharepoint online site using MS graph

I am able to access the documents on my one drive with requests like this one:
https://graph.microsoft.com/v1.0/me/drive/root/children
I am able to access a document library of a root sharepoint site of my company with a request like this:
https://graph.microsoft.com/v1.0/drive/root/children
It gives me the contents of the "root" library:
https://<my company>.sharepoint.com/Shared%20Documents
I am not able to access the document library of a SP subsite I created. e.g. this one:
https://<my company>.sharepoint.com/samplesp/Shared%20Documents
How can I access such a document library with MS Graph?
For accessing SharePoint sites and lists check out documentation of the SharePoint API in Microsoft Graph.
Update:
For those who have problems with accessing default Drive (formerly "Documents" library) on a specific SharePoint site using MS Graph API:
You should look into the documentation for accessing files on OneDrive.
As said in the question, this endpoint gives us a list of files on private OneDrive:
.../me/drive/root/children
Drive on SharePoint's sites works in the same way, but instead of me you should provide global Id of the site you want to access (global Id is <hostName>,<siteCollectionId>,<siteId>).
In conclusion: this endpoint gives us a list of files on a specified site's default drive:
.../Sharepoint/sites/<hostName>,<siteCollectionId>,<siteId>/drive/root/children
If you want to access files on a specific list, all you need is the id of the list:
.../Sharepoint/sites/<hostName>,<siteCollectionId>,<siteId>/lists/<listId>/drive/root/children
Now it should be obvious.

Which set of APIs should be used for Office365 Sharepoint

Which set of APIs should be use to access Office365 sharepoint which includes both sharepoint2013 and sharepoint2016.
Have gone through the following APIs
1) Sharepoint2013 REST APIs(https://msdn.microsoft.com/en-us/library/office/jj860569.aspx).
2) OneDrive new APIs(https://github.com/OneDrive/onedrive-api-docs) through which we can access the Directory folder which contains directory and files. But the present focus of APIs are for OneDrive Personal and Business.
Apart from this is there any other APIs which can access the office365 sharepoint?
You could use SharePoint REST API to retrieve, update, and manage data in Sharepoint Online ,you could find code samples and videos from here.
With Graph API you could get files/users/groups ,but SharePoint sites and lists are not yet available via Microsoft Graph .
In addition ,you could also use SharePoint client object model (CSOM) to manage data in Sharepoint Online,please read below article:
Connect to SharePoint Online using Client Object Model

accessing files and folders other than sharepoint site's default shared documents using office365 api

Working on windows store apps:
I am trying to access the files and folders of office365 documents library.
I can access the one drive documents as described in this link Common file tasks using the Office 365 client library
But it do not provide a way to access the files and folders in other than onedrive document library.
e.g [https://my-office365-tenant.sharepoint.com/mysite/mydocumentslibrary]
However i had tried a way and it do get the files and folders other than onedrive.
I had not used any capability i created SharePointClient as given below:
var client = new SharePointClient(new Uri("https://my-office365-tenant.sharepoint.com/mysite"),
async () => await AcquireTokenAsync(AuthenticationContext, "https://my-office365-tenant.sharepoint.com"));
IPagedCollection<IItem> items = await client.Files.ExecuteAsync();
In this way i get the files of default "Shared Documents" document library inside "mysite", but i want to get the files and folders of another documents library "mydocumentslibrary" inside same site "mysite".
Can anyone please guide me how to do that or am i missing something? or there is anyother way to do this using office365 api only.
I just went through the documentation of this new API, it seems the file operation is limited to the one drive, I doubt you can get file in another document library.
To get files in other document library, as you're developing windows store APPs, you can SharePoint mobile object model or REST APIs:
Overview of the SharePoint 2013 mobile object model
Get started withthe SharePoint 2013 REST service
The APIs allows access only to default document library. Example:
OneDrive for Business: https://{tenant}-my.sharepoint.com/_api/v1.0/me
SharePoint sites: https://{tenant}.sharepoint.com/{site-path}/_api/v1.0

Resources