하위 폴더가 포함 된 문서 라이브러리에서 모든 목록 항목을 검색하기 위해 클라이언트 측 개체 모델 방식 C#을 사용하고 있습니다. MSDN 설명서를 체크 아웃하고 필드 속성을 가져올 수없는 이유 또는 내가이 일을 제대로 수행하지 못하는 경우에 붙어 있습니다.문서 라이브러리의 모든 하위 폴더에서 모든 문서 가져 오기 - CSOM
NetworkCredential credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
ClientContext clientcontext = new ClientContext(Resources.defaultSPSite);
clientcontext.Credentials = credentials;
//Load Libraries from SharePoint
//Web site = clientcontext.Web;
clientcontext.Load(clientcontext.Web.Lists);
clientcontext.ExecuteQuery();
//List sharedDocumentsList = clientcontext.Web.Lists.GetByTitle("TestLDOCS");
//CamlQuery camlQuery = new CamlQuery();
//camlQuery.ViewXml = @"<View Scope='Recursive'><Query></Query></View>";
foreach (List list in clientcontext.Web.Lists)
{
clientcontext.Load(list);
clientcontext.ExecuteQuery();
//list.TemplateFeatureId.ToString().Equals("") &&
string baseType = list.BaseType.ToString();
string listTitle = list.Title.ToString();
if (list.BaseType.ToString().Equals("DocumentLibrary", StringComparison.InvariantCultureIgnoreCase) && list.Title.ToString().Equals("TestLDOCS", StringComparison.InvariantCultureIgnoreCase))
{
foreach (Folder subFolder in list.RootFolder.Folders)
{
foreach (File f in subFolder.Files)
{
Console.WriteLine((string) f.Title);
}
}
}
}
}
내가 수신하고이 오류는 "foreach는 (subFolder.Files에서 파일 f는)"컬렉션에 오류가 초기화되지 않을 수 있다는 것이다. CSOM을 사용하여 문서 라이브러리 내의 모든 하위 폴더에있는 모든 문서의 필드 값을 가져올 수 있습니까?
필드 값을 목록 항목 즉, (listItem [ "fieldName"])과 함께 강하게 입력 할 수 있다는 것을 알고 있습니다. 대신이 길로 가야합니까?
당신의 접근 방식은 정말 좋은 것 같아요,하지만 난 NotSupportedException 점점'items.Select (i => i.File)' – Santhos