0

I'm currently working on an integration between Salesforce and Sharepoint. I can upload files but i couldn't manage to find a way to add some metadata to the files ( adding values in the "properties" fields in Sharepoint)

The closest I got was what with the code right under, I managed to update a folder's name.

public static void postMetadataTest(TokenParse tokenParse){
String token = tokenParse.access_token;
String stringData = ' {"name":"NewFolder"}';
Integer dataLengh = stringData.length();
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setHeader('Authorization', 'Bearer '+ token);
req.setHeader('Content-Type', 'application/json');
req.setHeader('Accept', 'application/json');
req.setHeader('IF-MATCH', '*');
req.setHeader('X-HTTP-Method', 'MERGE');
req.setHeader('Content-Length', String.valueOf(dataLengh));
string endPoint = 'https://graph.microsoft.com/v1.0/sites/viseoxxxxx.sharepoint.com,104299d7-cf57-41c9-bd42-3632f6bc7121,82759e04-256a-4be1-bae3-71f84463453e/drive/items/01FJDRFDOG3ZRYXRRSORAZQRZ4FEEZDAK2?_HttpMethod=PATCH';
req.setBody(stringData);
req.setEndpoint(endPoint);
HttpResponse res = h.send(req);
System.debug('Response Body: ' + res.getBody());
}

Where should i go from here to add metadata to a file?

Thanks

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.