private static ClientContext CreateContext(string contextUrl, ICredentials credentials) { ClientContext context = null; if (!String.IsNullOrEmpty(AppId) && !String.IsNullOrEmpty(AppSecret)) { OfficeDevPnP.Core.AuthenticationManager am = new OfficeDevPnP.Core.AuthenticationManager(); if (new Uri(DevSiteUrl).DnsSafeHost.Contains("spoppe.com")) { context = am.GetAppOnlyAuthenticatedContext(DevSiteUrl, SPOnlineConnectionHelper.GetRealmFromTargetUrl(new Uri(DevSiteUrl)), AppId, AppSecret, acsHostUrl: "windows-ppe.net", globalEndPointPrefix: "login"); } else { context = am.GetAppOnlyAuthenticatedContext(DevSiteUrl, AppId, AppSecret); } } else { context = new ClientContext(DevSiteUrl); context.Credentials = Credentials; } context.RequestTimeout = Timeout.Infinite; return(context); }
private static ClientContext CreateContext(string contextUrl, ICredentials credentials) { ClientContext context; if (!String.IsNullOrEmpty(Realm) && !String.IsNullOrEmpty(AppId) && !String.IsNullOrEmpty(AppSecret)) { var am = new OfficeDevPnP.Core.AuthenticationManager(); context = am.GetAppOnlyAuthenticatedContext(contextUrl, Realm, AppId, AppSecret); } else { context = new ClientContext(contextUrl); context.Credentials = credentials; } return(context); }
private static ClientContext CreateContext(string contextUrl, ICredentials credentials) { ClientContext context = null; if (!String.IsNullOrEmpty(AppId) && !String.IsNullOrEmpty(AppSecret)) { OfficeDevPnP.Core.AuthenticationManager am = new OfficeDevPnP.Core.AuthenticationManager(); if (new Uri(DevSiteUrl).DnsSafeHost.Contains("spoppe.com")) { context = am.GetAppOnlyAuthenticatedContext(DevSiteUrl, SPOnlineConnectionHelper.GetRealmFromTargetUrl(new Uri(DevSiteUrl)), AppId, AppSecret, acsHostUrl: "windows-ppe.net", globalEndPointPrefix: "login"); } else { context = am.GetAppOnlyAuthenticatedContext(DevSiteUrl, AppId, AppSecret); } } else { context = new ClientContext(DevSiteUrl); context.Credentials = Credentials; } context.RequestTimeout = Timeout.Infinite; return context; }
private static ClientContext CreateContext(string contextUrl, ICredentials credentials) { ClientContext context; if (!String.IsNullOrEmpty(Realm) && !String.IsNullOrEmpty(AppId) && !String.IsNullOrEmpty(AppSecret)) { var am = new OfficeDevPnP.Core.AuthenticationManager(); context = am.GetAppOnlyAuthenticatedContext(contextUrl, Realm, AppId, AppSecret); } else { context = new ClientContext(contextUrl); context.Credentials = credentials; } return context; }