I am creating folders and posting files to SharePoint successfully using REST API in NodeJS. The library I used is "request-promise-native" and everything is working fine. Now, I want to add metadata tags along with my file. I want to add the default tag "Title". Do i need a separate API call after posting my file to add metadata tag or i can do it in one go.

the official docs say that to add this in the rest API,

data: JSON.stringify({
            '__metadata': { 'type': 'SP.ListItem' },
            'Title': 'My Name is Khan'

After adding this, the file post is successful but metadata tags are not shown.

Can anyone help me in this regards? If you need any code snippet, I can provide that too.

This is my rest call for file posting.

        url: urlString,
        headers: postFileHeaders,
        method: "POST",
        agent: false,
        agentOptions: {
            secureProtocol: 'TLSv1_method'
        rejectUnauthorized: false,
        secureOptions: constants.SSL_OP_NO_TLSv1,
        honorCipherOrder: true,
        strictSSL: false,
        body: bodyContents,
        data: JSON.stringify({
            '__metadata': { 'type': 'SP.ListItem' },
            'Title': 'My Name is Khan'

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.