0

I am trying to retrieve the content of a specific version with Sharepoint API. I can get metadata like this :

{
"d": {
    "results": [
        {
            "__metadata": {
                "id": "https://sharepointtest/_api/SP.FileVersionIDVERSION",
                "uri": "https://sharepointtest/_api/SP.FileVersionIDVERSION",
                "type": "SP.FileVersion"
            },
            "CreatedBy": {
                "__deferred": {
                    "uri": "https://sharepointtest/_api/SP.FileVersionIDVERSION/CreatedBy"
                }
            },
            "CheckInComment": "",
            "Created": "2019-05-14T07:45:15Z",
            "ID": 512,
            "IsCurrentVersion": false,
            "Length": "4560528",
            "Size": 4560528,
            "Url": "_vti_history/512/Shared documents/sampleversion.odt",
            "VersionLabel": "1.0"
        }
    ]
}

Using this, does anyone know how to get it as an InputStream with Java? My function in Java is

public ContentReturn getContent() {
    InputStream content = null;
    HttpGet httpGet = new HttpGet();
    try {
        httpGet =  new HttpGet("I DON'T KNOW WHAT I SHOULD PUT HERE THIS IS THE QUESTION :)" );

                content = client.execute(httpGet).getEntity().getContent();
        content.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return new ContentReturn(content, httpGet);
}
}

Thanks by advance!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.