Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Metadata not updated #20

Closed
JedCarrNV opened this issue Sep 8, 2016 · 4 comments
Closed

Custom Metadata not updated #20

JedCarrNV opened this issue Sep 8, 2016 · 4 comments

Comments

@JedCarrNV
Copy link

Hi there,

Trying to update some custom metadata with a glob. Here are my options:

saveOptions = {
    glob: 'xml/pet 123122.xml',
    notification: true,
    folder: '/Pet%2097%20Archive',
    filesMetaData: [{
        metadata: {
            '__metadata':{type:'SP.Data.Pet_x0020_97_x0020_ArchiveItem'},
            'Pet Name': 'Doggy McDogFace',
            'Pet ID#': '666',
            'Title':'McDogFace is awesome'
        }
    }]
}

The file uploads just fine, but Pet Name, ID and title don't get updated. Not sure I'm doing something wrong. Any help will be greatly appreciated.

@s-KaiNet
Copy link
Owner

s-KaiNet commented Sep 8, 2016

Take a look at this recipe - you need to provide file name option:

[{
    fileName: 'pet 123122.xml',
    metadata: {
        '__metadata':{type:'SP.Data.Pet_x0020_97_x0020_ArchiveItem'},
        'Pet Name': 'Doggy McDogFace',
        'Pet ID#': '666',
        'Title':'McDogFace is awesome'
    }
}]

fileName required, because when using globs like xml/*.*, spsave needs to know how to map each file to metadata.
For multiple files you will write:

glob: 'xml/*.xml',
    notification: true,
    folder: '/Pet%2097%20Archive',
    filesMetaData: [{
        fileName: 'pet 1.xml',
        metadata: {
            '__metadata':{type:'SP.Data.Pet_x0020_97_x0020_ArchiveItem'},
            'Pet Name': 'Doggy McDogFace',
            'Pet ID#': '666',
            'Title':'McDogFace is awesome'
        }
    }, 
    {
        fileName: 'pet 2.xml',
        metadata: {
            '__metadata':{type:'SP.Data.Pet_x0020_97_x0020_ArchiveItem'},
            'Pet Name': 'Cool dog',
            'Pet ID#': '777',
            'Title':'McDogFace is awesome'
        }
    }]

@JedCarrNV
Copy link
Author

Ah that was it.

Also the Field names needed be escaped as Pet_x0020_Name and Pet_x0020_ID_x0023_

Thank you, you are doing awesome work!

@s-KaiNet
Copy link
Owner

s-KaiNet commented Sep 8, 2016

Right, actually internal names should be used as field names.

@SteenMolberg
Copy link

Thx harry,

That was just what I needed!!

/Steen

Fra: Sergei Sergeev [mailto:notifications@github.com]
Sendt: 8. september 2016 20:35
Til: s-KaiNet/spsave spsave@noreply.github.com
Emne: Re: [s-KaiNet/spsave] Custom Metadata not updated (#20)

Take a look at thishttps://github.com/s-KaiNet/spsave/blob/master/docs/Recipes.md#save-file-using-its-name-and-content-update-metadata-for-the-file recipe - you need to provide file name option:

[{

fileName: 'pet 123122.xml',

metadata: {

    '__metadata':{type:'SP.Data.Pet_x0020_97_x0020_ArchiveItem'},

    'Pet Name': 'Doggy McDogFace',

    'Pet ID#': '666',

    'Title':'McDogFace is awesome'

}

}]

fileName required, because when using globs like xml/., spsave needs to know how to map each file to metadata.

For multiple files you will write:

glob: 'xml/*.xml',

notification: true,

folder: '/Pet%2097%20Archive',

filesMetaData: [{

    fileName: 'pet 1.xml',

    metadata: {

        '__metadata':{type:'SP.Data.Pet_x0020_97_x0020_ArchiveItem'},

        'Pet Name': 'Doggy McDogFace',

        'Pet ID#': '666',

        'Title':'McDogFace is awesome'

    }

},

{

    fileName: 'pet 2.xml',

    metadata: {

        '__metadata':{type:'SP.Data.Pet_x0020_97_x0020_ArchiveItem'},

        'Pet Name': 'Cool dog',

        'Pet ID#': '777',

        'Title':'McDogFace is awesome'

    }

}]


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/20#issuecomment-245695230, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIGNO5PA_y2jo5Lfp8YAOkoasW_FG3uLks5qoFVSgaJpZM4J4Ol4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants