Jan 24 2019 05:05 AM - edited Jan 24 2019 05:05 AM
How to fetch O 365 SP Online list items inside a ASP.NET application.
Am having a requirement, wherein an asp.net MVC application is built and deployed on-prem.
Also, as part of this application there is this module, where users need to key-in lot of input.
But, we have already built this module last year as an SPO site in O 365 using JSOM,SP D workflows etc( not with SPFx). <p>
Now customer wants to pull this list items of this module into the ASP.NET MVC application , when on button click or dropdown change-(of course , some conditions applied - fetch some IDs, names,status columns etc from SPO-SPList).
Am wondering, any programmatic way of achieving this without using any 3rd party tools or without any Server side coding.
Jan 24 2019 11:18 AM
Within you ASP.Net MVC application, add the csom Nuget Package https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/ and then you should be able to perform CRUD operations on a sharepoint list from your ASP.Net Application. Ideally it is doable.
@Prasad Punneri wrote:How to fetch O 365 SP Online list items inside a ASP.NET application.
Am having a requirement, wherein an asp.net MVC application is built and deployed on-prem.
Also, as part of this application there is this module, where users need to key-in lot of input.
But, we have already built this module last year as an SPO site in O 365 using JSOM,SP D workflows etc( not with SPFx). <p>
Now customer wants to pull this list items of this module into the ASP.NET MVC application , when on button click or dropdown change-(of course , some conditions applied - fetch some IDs, names,status columns etc from SPO-SPList).
Am wondering, any programmatic way of achieving this without using any 3rd party tools or without any Server side coding.
Jan 25 2019 12:23 AM
What about the authentication ? since, our ASP.NET is deployed in on-prem and SPO in O 365.
is it possible to interact from a asp.net on-prem appln to SPO cloud?
asp.net is using the windows auth. and SPO is using auth. based on Azure.
Should not it throw error while trying to connect SPSite in SPO from this asp.net appln?
Jan 25 2019 08:07 AM
Jan 25 2019 02:06 PM
If your fine with not using the User Context, You can create a Service Account and use that to perform the CRUD Operation on the SharePoint List. Sample Code Below..
Jan 28 2019 02:47 AM - edited Jan 28 2019 02:51 AM
creating a service account is not possible, as we have requested to customer for creation of a serviceaccount already, from last year onwards. but unfortunately,they are not ready to provide us this service account id.
Jan 28 2019 02:49 AM
At present,client is not giving us necessary permissions to even for accessing the tenant. we dont have site collec.permissions, we dont have powershell access, and dont have O 365 Admin center access!
is it possible to create /register an app in SPO without those privileges.
Jan 28 2019 01:07 PM - edited Jan 28 2019 01:10 PM
You must have Site Collection access. If you Don't have SC access, you need to ask the client to Do the Steps.
Step -1 - Register a new app
http://{sharepointsite}/_layouts/15/AppRegNew.aspx
Step2- Grant permissions for the app
https://*******************.sharepoint.com/sites/********/_layouts/15/Appinv.aspx
Lookup the client Id from Step 1
In the Permissions use this. -
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
</AppPermissionRequests>
Step3 -
Step3 - Follow instruction in Blog - http://www.sharepointpals.com/post/How-to-Get-the-Client-Context-Using-App-Access-token-by-passing-C...
sample code attached