문제

CSOM을 사용하여 목록의 URL 이름을 가져 오는 가장 좋은 방법은 무엇입니까?

예를 들어, 우리는 목록 / 사이트 / 사이트 / 목록 / myList / 를 가지고 있습니다.

우리는 "mylist"가 필요합니다.

예를 들어 list.rootfolder.serverRelativeURL을 구문 분석 할 수 있습니다. 그러나 더 나은 방법이 있습니까?

도움이 되었습니까?

해결책

Try:

List.RootFolder.Name

It should work for both lists and document libraries.

다른 팁

예 : 목록 이름을 제목으로 가져 오는 방법 :

public static string ResolveListUrl(string url, ICredentials credentials, string listTitle)
{
    using (var clientContext = new ClientContext(url))
    {
        clientContext.Credentials = credentials;

        var list = clientContext.Web.Lists.GetByTitle(listTitle);
        clientContext.Load(list.RootFolder);
        clientContext.ExecuteQuery();
        return list.RootFolder.Name;
    }
}
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top