SharePoint 2013 - App. Mix CSOM and JSOM? - oauth

I need to write an Office365-App. I want to use a provider-hosted MVC-Application for this.
As I want to use some kind of "API" on some pages, that returns a JSON that then is used inside JS to display data:
Can I just mix CSOM and JSOM?
Has this any effect on the (OAuth)-Authentication?

You could mix CSOM and JSOM . I would suggest you could use the SharePoint Cross Domain JavaScript library (CDL) to access SharePoint data from a remotely hosted web page without the need for OAuth tokens. Please refer to below link for code sample:
https://github.com/OfficeDev/SharePoint-Add-in-JSOM-CrossDomain
I have tested the codes in a CSOM OAuth authentication web application ,and it works fine .

Related

Access SharePoint document library using ASP.Net MVC

I have developed an ASP.Net MVC application which is Azure Single-Sign-On supported.
In the existing application, I wanted to consume online SharePoint REST API's to work with the document library(Get folders/files,upload, add, replace and delete etc.)
Is there any way to do/achieve this task.
Thanks in advance!
yes, the supported way is to use SharePoint CSOM which is now in .net standard. Please see this article were you may find a movie that shows the whole process to add nuget, authenticate the app and get some data from SharePoint, and here is he msdn support.
Some CSOM examples how this works

linkedin fetching details in asp.net MVC

Out of the two methods of : JS API and OAUTH ,can anyone suggests which one is more reliable and should be used?
I want user to come on my application and from there I want them to login in LinkedIn from where all his personal data will be fetched and shown in my application . I have done this with JS API but still confused b/w the two.
Thanks,
Both are same if you want to use JS API then you may include js code in your code otherwise you can use OAUTH, Both methods are fetching same fields.
If you want to use JS API you can refer these links-
http://www.aspdotnet-suresh.com/2013/05/get-linkedin-logged-in-user.html
for OAUTH - http://mvcrocksonasp.net/OAuthWithMVC4
get code from these links.

Azure website fails to call SharePoint CSOM

My provider-hosted (MVC) app for SharePoint 2013 is deployed to Azure website. However once it calls SharePoint CSOM it fails with unexpected error.
Any idea why?
Thanks!
This occurs when you make a request directly to web site, using a url (e.g. "xxx.azurewebsites.net") because in your "Index" ActionMethod is marked with:
[SharePointContextFilter]
If you want access to your web site outside from Sharepoint, you can have in your Provider App, two controllers. One configured how ClientWebPart for access inside from Sharepoint and other for external access.

Custom authorization in MVC4 and Web API

I'm being confused by the custom authorization in MVC4.
I have implemented a custom security attribute (based on System.Web.Mvc.AuthorizeAttribute) that worked fine and now I started to extend my project with a web api. However, it seems that the web api needs to use the System.Web.Http.AuthorizeAttribute (?).
Can't I use the same authorization for both web api and standard mvc pages?
Simply said: no you cannot. The systems were made seperatly. It might be possible that Microsoft will merge these in the future.

How to pull a Sharepoint List with a Rails app?

I would like to enable a rails app to pull from a sharepoint list in order to update a model. Has anybody meshed up these two things?
Have you tried to use the SharePoint Web service? you have to use SOAP library
to access the wsdl and to use the specified credential
http://yoursharepoint-site/_vti_bin/Lists.asmx?wsdl
There's multitude of web-service methods you could use to manipulate list on List.asmx web service.
I was implementing a code in PHP for it, and this link that help me to get started to access the web-service and use GetListItems method
http://davidsit.wordpress.com/2010/02/23/reading-a-sharepoint-list-with-php/
you'll get the idea

Resources