Connect to SharePoint online in .net core - sharepoint

Recently my application was converted from .net framework 4.6 application to .net core 2.0 app.
In the application I used SharePointOnlineCredentials to connect SharePoint. This class (which you can find in Microsoft.SharePoint.Client.dll) doesn't support .net core yet.
I did try to use NetworkCredential class but it doesn't seem to work (Username like xx#company.onmicrosoft.com).
I would like to avoid working with OAuth if possible.
Any idea?
Thanks!

Related

How to ouput Trace statement to Azure Application logs in ASP.NET Core Application?

I've an ASP.NET Core Application (.net Framework) and that references my other .net Framework dlls.
I've configured logging in my ASP.NET Application using "Microsoft.Extensions.Logging.AzureAppServices" and injecting ILogger to controllers. All that works fine. all my logs are written to azure application logs in Azure.
In my .net framework dll, i've Trace.TraceError, TraceWarning statements. And I would like to include them in azure application log. but I cannot find any way to do it.
Looking forward for some help.
You will have to use the logging framework of ASP.NET Core (ILogger and friends) in your .NET Framework class library/DLL if you want them appear in the same application log.
Another option might be to convert the library to use the TraceSource system, there is a logging provider for ASP.NET Core available. If you're unable to make changes to the existing library, I'm afraid you're out of options.

Azure AD B2C example fail to compile for .Net Core 2.0

I used this sample https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp for my .net core 1.1 web app. Now, I've been trying to make it work myself for .NET Core 2.0 but had no luck, too much unclear things in all this.
So, can anyone provide an example of how to use Azure AD B2C with ASP.Net Core 2.0?
A new branch was created with the version upgrade. It's a community submission and not yet tested by the product team but check it out: https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp/tree/core2.0

How do I add .NET Core class library reference in Service Fabric App

How do I add .NET Core class library reference in Service Fabric App.
While I'm adding Class Library reference (.NET Core) in WebAPI app, showing Compatibility issues. Please find below What I did, using Visual Studio 2017.
File >> New Project >> Cloud >> Service Fabric Application
Name - FirstServiceFabricApp
Select a Template >> Stateless ASP.NET Core
Name - FirstStatelessAPI
Build and Run the Project. It works.
Although API Project Framework version is .NET Framework 4.5.2.
Added Class Library Project [builds on .NET Core 1.1] as reference into Stateless WebAPI Project. Showing compatibility issues-
Building the solution x64 platform.
My concerns are:
How do I take .NET Core Library reference in Stateless WebAPI Project [Service Fabric]
Should I go/develop with .NET Framework for Class Library which is compatible with Stateless WebAPI project.
I did Azure AD Authentication/Microsoft Graph in Azure APP Service, but never did for Service Fabric App. Whether Azure AD and Microsoft Graph implementation is same in this Stateless WebAPI App. Kindly provide some references on this.
You need to make your class library target a compatible framework e.g. net452 (or netstandard2.0 when it's supported like 2017 Q3)
The below link talks about converting a .net core to azure service fabric application.
It talks about statefulservice. Statelessservice is more or less similar to it.
http://dotnetextensions.blogspot.in/2018/04/convert-dot-net-core-application-to.html?m=1
When it comes to azure ad, i won't have much impact. You can continue to use the same thing

ASP.Net API running on Windows Azure websites

I have an MVC project in Visual Studio 2012 RC which hosts an MVC web site and an ASP.NET API. I use routes to delegate the request to the correct controller.
On my local development machine both the website and api work fine. However when I push the change to Azure websites the website works, but the ASP.NET web api returns HTTP 500 errors.
The base site is: http://salaahtime.azurewebsites.net
One of the web site pages is http://salaahtime.azurewebsites.net/website/login
An example use of the API is http://salaahtime.azurewebsites.net/api/salaahtime/testestablishment/2012/1
However this returns HTTP 500.
I have
Updated my project to use .net 4.0. By default it is set to .net 4.5 which does not work with Azure websites
Removed Entity Framework 5.0 reference which only works with .net 4.5
Any ideas why the api would not work in Azure websites?
There is a known issue when backing a project down from 4.5 to 4.0 using the RC release of Visual Studio 2012. I know this will be slightly painful to hear, but you'll be better off creating a new project and setting the project's framework version to 4 rather than 4.5. This is an issue that should be fixed prior to the product's release.
Hope this helps. Trust me, we know of it and in our own development work have had to re-create projects using the 4 framework.
Also - the 4.5 framework will be supported in Windows Azure Web Sites once the 4.5 framework has been officially released.
Please try to turn off custom error (http://msdn.microsoft.com/en-us/library/h0hfz6fc.aspx), which may give more detailed information. If you’re working with a database, make sure you’ve updated the connection string to use Windows Azure SQL Database instead of a local database. There is also a possibility that Web API is not stood by web sites. The name web sites indicate it is used to build web sites, not web platforms. Web sites have limited features compared to web roles and virtual machines. If that’s the case, please use a web role or a virtual machine.
Best Regards,
Ming Xu.

WCF Service for adding Sharepoint users?

Currently we have an application that is written in .NET 3.5, which we are planning on upgrading to .NET 4.0.
Is it possible to create a WCF service that could make use of SharePoint 2010 API to create Sharepoint users by calling that service from .NET 4.0 application? What sort of issues do you think i may run in to if we upgrade, as Sharepoint 2010 works with .NET 3.5 and not 4.0?
Yes, you can use .Net 3.5 web service in your .Net 4 application .
You will have difficulties with DTO types, but if you use the properly serialized xml data then, should be no problem.

Resources