Search code examples
apisharepointsharepoint-addin

Acess to sharepoint api


In the past I wrote application that connects to OneDrive using Microsoft Graph.

Now my boss asked me to write application to communicate with SharePoint, so the situation is like this: I have in a separate network (without internet connection) a shrepoint server. I can access to SharePoint management from browser like: http://mySharePoint:5186

my qustion, how do I register my application, since the sharepoint server and the application that will connect to this SharePoint are not connected to th internet. I mean how do I get client id, token etc..

I have tried to regitser the app i.w I wrote in browswer: http://mySharePoint/_layout/15/appreqnew.aspx but I'm getting "Sorry, something went wrong" error at the browser


Solution

  • Microsoft Graph does not support on-premises SharePoint Servers. There is a great document here that can help you understand your scenario https://learn.microsoft.com/en-us/sharepoint/dev/general-development/choose-the-right-api-set-in-sharepoint

    If you are running the code within SharePoint server context in page the auth is handled for you. If you are calling the API from a service outside SharePoint server context. you'll have to read more on SharePoint REST API auth. There are too many scenarios but there is more on this here https://learn.microsoft.com/en-us/sharepoint/dev/general-development/build-mobile-apps-for-other-platforms-using-sharepoint#BuildMobileAppsInSharePoint2013ForNonWindowsPhone_AuthenticatingNonWindowsAppForSharePoint