Forum Discussion
Christopher Johnson
Nov 16, 2016Brass Contributor
Is it possible to create a Tenant object without Add-in Only authentication?
I am creating a timer job to provision sites asynchronously, similar to PnP Provisioning.OnPrem.Async project sample here. This is for on-premises SharePoint 2016, and I am having trouble getting Ap...
Ivan Vagunin
Nov 16, 2016Brass Contributor
Hi,
Definetly possible. You don't need to create a access token if you don't want to use add-in authentication. You can use Windows authentication instead and authenticate with current Windows account or stored credentials. Just create an instance of ClientContext and set Credentials like this:
using (var actx = new ClientContext(tenantAdminUri.ToString()))
{
//use current user
actx.Credentials = CredentialCache.DefaultNetworkCredentials;
//use stored credentials
actx.Credentials = OfficeDevPnP.Core.Utilities.CredentialManager.GetCredential("MyCredentials")
}
- Christopher JohnsonNov 16, 2016Brass Contributor
Ivan Vagunin thank you, I will try and post back.