本文整理汇总了C#中ClientContext.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ClientContext.GetType方法的具体用法?C# ClientContext.GetType怎么用?C# ClientContext.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientContext
的用法示例。
在下文中一共展示了ClientContext.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertFrom
public static PnPClientContext ConvertFrom(ClientContext clientContext, int retryCount = 10, int delay = 500)
{
var context = new PnPClientContext(clientContext.Url, retryCount, delay);
context.AuthenticationMode = clientContext.AuthenticationMode;
// In case of using networkcredentials in on premises or SharePointOnlineCredentials in Office 365
if (clientContext.Credentials != null)
{
context.Credentials = clientContext.Credentials;
}
else
{
//Take over the form digest handling setting
context.FormDigestHandlingEnabled = clientContext.FormDigestHandlingEnabled;
// In case of app only or SAML
context.ExecutingWebRequest += delegate (object oSender, WebRequestEventArgs webRequestEventArgs)
{
// Call the ExecutingWebRequest delegate method from the original ClientContext object, but pass along the webRequestEventArgs of
// the new delegate method
MethodInfo methodInfo = clientContext.GetType().GetMethod("OnExecutingWebRequest", BindingFlags.Instance | BindingFlags.NonPublic);
object[] parametersArray = new object[] { webRequestEventArgs };
methodInfo.Invoke(clientContext, parametersArray);
};
}
return context;
}