How do you create a folder in document library. I got this code right now but getting error code 403 FORBIDDEN

public void createFolder(String digest) throws ClientProtocolException, IOException {
    HttpPost request = new HttpPost(
    request.addHeader("Content-Type", "application/json;odata=verbose");
    request.addHeader("X-RequestDigest", digest);
    request.addHeader("Accept", "application/json;odata=verbose");
    CloseableHttpResponse response = httpClient.execute(target, request, context);
    System.out.println("STATUS CODE: " + response.getStatusLine());
  • The documentation states that a site relative url will work, strange that it does not here. Have you tried a server relative url or the method here?
    – wjervis
    Feb 26, 2015 at 14:39
  • The method you mentioned Feb 26, 2015 at 15:00
  • Sorry i edited the question. i get error code 403 forbidden Feb 26, 2015 at 15:01
  • Oh, should've asked the obvious, do you have the authorization token?
    – wjervis
    Feb 26, 2015 at 15:13
  • The Digest you mean? Feb 26, 2015 at 15:14


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.

Browse other questions tagged or ask your own question.