1 diff --git a/src/libcmis/sharepoint-repository.cxx b/src/libcmis/sharepoint-repository.cxx
2 index 780624d..f992689 100644
3 --- a/src/libcmis/sharepoint-repository.cxx
4 +++ b/src/libcmis/sharepoint-repository.cxx
5 @@ -35,7 +35,18 @@ SharePointRepository::SharePointRepository( std::string baseUrl ) :
6 m_description = "SharePoint repository";
7 m_productName = "SharePoint";
8 m_productVersion = "2010/2013";
9 - m_rootId = baseUrl + "/getFolderByServerRelativeUrl('/')";
10 + // getFolderByServerRelativeUrl() API expects path to be
11 + // *server-relative*, i.e. they must include site path.
12 + // Given the baseUrl like "https://sp2013/sites/mysite/_api/Web"
13 + // for a site "mysite" on sharepoint server "sp2013",
14 + // the site root is '/sites/mysite/', not '/'.
15 + // Trying to get folder '/' results in "Value does not fall
16 + // within expected range" error.
17 + // Preferrable here is to extract the root path from baseUrl,
18 + // stripping server and api parts. But it can be unreliable
19 + // if api part (_api/Web) is different for some server.
20 + // On the other side, just querying empty path '' gives the root folder.
21 + m_rootId = baseUrl + "/getFolderByServerRelativeUrl('')";
23 m_capabilities[ ACL ] = "discover";
24 m_capabilities[ AllVersionsSearchable ] = "true";