2

I just tring to open the subsite using the CSOM. I'm geting the below error in clientContext.ExecuteQuery(). site URL is https://xxxxxxxx.sharepoint.com/Customer Orders

File Not Found.

        cTokenHelper.TrustAllCertificates();
            clientContext = TokenHelper.GetClientContextWithAccessToken(SPHostUrl, accessToken);
        Uri oUri = new Uri(SiteUrl);
        oWebsite = clientContext.Site.OpenWeb(oUri.AbsolutePath);
        clientContext.Load(oWebsite);
        clientContext.ExecuteQuery();

1 Answer 1

3

From MSDN

Parameters strUrlType: System.String

Specifies the server-relative URL or web-relative URL of the site to open. If strurl is empty, the top-level site must be opened.

So what you need to pass as a parameter to OpenWeb is the relative URL. Instead of "https://xxxxxxxx.sharepoint.com/Customer Orders" it is just "Customer Orders"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.