其他分享
首页 > 其他分享> > .Net操作Sahrepoint常用操作(1) 判断List会Library是否存在

.Net操作Sahrepoint常用操作(1) 判断List会Library是否存在

作者:互联网

private static bool CheckSPConnect(Guid SPListId)
{
  bool isOk = false;

  try
  {
    OfficeDevPnP.Core.AuthenticationManager authManager = new OfficeDevPnP.Core.AuthenticationManager();
    using (var clientContext = authManager.GetNetworkCredentialAuthenticatedContext(ConfigurationHelper.GetSPSiteURL(), ConfigurationHelper.GetSPUserAccount(), ConfigurationHelper.GetSPUserPassword(), ConfigurationHelper.GetDomainName()))
    {
      bool listExists = clientContext.Web.ListExists(SPListId);
      if (listExists == true)
      {
        isOk = true;
      }
    }
  }
  catch(Exception ex)
  {

  }

  return isOk;
}

 

标签:Core,authManager,isOk,List,Sahrepoint,Library,ConfigurationHelper,bool,OfficeDev
来源: https://www.cnblogs.com/61007257Steven/p/14178445.html