locked
how to add metadata to files using winjs

    Question

  • I am am able to change the old metadata but cannot add new metadata to video files

    openPicker.pickSingleFileAsync().then(function (file) {

            if (file) {
                file.properties.getVideoPropertiesAsync().then(function (fileProperties) {

                    console.log('filename is ' + fileProperties.title);
                    fileProperties.title = 'notitle';                                   //successfully changed the title
                    console.log('new title' + fileProperties.title);
                    file.properties.savePropertiesAsync();    // saved the changed data
                    if (fileProperties.owner) {       // trying to add new data owner to the file
                        console.log('owner exists' + fileProperties.owner);
                    } else {

                        console.log(' no owner  exists , setting the owner ');
                        fileProperties.owner = 'Mayank'; // how do i add this new metadata if it does not exist already
                        console.log('new owner ' + fileProperties.owner);

    file.properties.savePropertiesAsync(); 

                       }

               });

        });                                                                                         

    mayanklohani


    Wednesday, March 19, 2014 10:15 AM

Answers

All replies

  • What you are trying to perform is to set the value of "System.FileOwner" property which is a read-only property.

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefile.properties.aspx shows how you can retrieve the extended properties of a file and a File Owner is a read-only property. You cannot even reset this value from the UI - if you right-click the file, choose Properties -> Details -> Scroll Down --> Owner. This property is read only, and not settable.

    Thanks,

    Prashant.


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Thursday, March 20, 2014 1:31 AM
    Moderator
  • I just want to add some some new metadata to the given file, like for a  TV episode, add episode no,air date,description just like we do it in itunes.

    mayanklohani

    Thursday, March 20, 2014 11:31 AM