CSOM code needs to use modern authentication

Brass Contributor

To whom may be willing to help,

 

I am an O365 Global administrator with very little knowledge about code.  We run into issues and need help.  With no coding background I am seeking help for some basic knowledge to educate myself first.  

 

We have migrated all SharePoint sites to O365 but site provisioning and some custom processes are still using old CSOM code developed while we were on-prem.  We use those for couple tasks:

1. site provisioning

2. Read list item, check date and send notification if items will expire soon

3. Search files and copy to other file share location

4. Rollup tasks to root site

 

All those customized code work fine until I configured SPO block access for "Apps that don't use modern authentication" -- service account login failed.  After troubleshooting and checking by other teammates I was told couple things:

 

* SPO API works but not function properly with modern authentication method

* The PnP Core is in Beta which tends to have errors so isn't useful for production code

* The Graph API lacks some critical functionality so not useful neither.  

 

I am trying to understand the statement and do some research to educate myself.  I just read MS article "Provisioning "modern" team sites programmatically" where it talks about using PnP CSOM core component to provision sites. 

 

After reading the article I have couple questions and wondering if someone is willing to help me understand:

 

1. It looks like the PnP Core component released on 10/2017.  is it still in Beta and not use modern authentication? Or are they different components?  If it's latter, which one should be used for site provisioning and can do the modern authentication?  Is there any github example for such case?  I did google search which shows couple results.  But I don't know which one uses modern authentication.

 

2.  Just like SharePoint itself there are always several ways of doing the same tasks.  I heard about SharePoint framework and all those APIs, .NET core, etc.  In terms of tasks like what we are doing (site provisioning, read/copy files, etc), which is(are) recommended method(s) for us?  I know it's a broad question and depends on the solutions/scenarios.  I just want to know in general at high level when to use what so I can do more digging to learn more.  

 

Any information you can provide is greatly appreciated!  Thanks in advance!!!

 

Sally

3 Replies

@C Lee 

 

For your requirements, I will recommend you to use Office Dev PnP Core library. This supports modern authentication as well using AuthenticationManager class which has various methods for authentication.

 

Check below links for more information on this:

  1. PnP Core library 
  2. Provisioning console application sample 
  3. Authentication to SharePoint Online with CSOM 

Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

 

@ganeshsanap 

 

Thanks for kindly sharing your experiences and the links.  Really appreciate your help!

 

Sally

Hi @C Lee , I was just curious how you worked around the searching capability.  Did you give them permission to search at a tenet level or how did you lock it down?  Thank you