I intend to keep track of the FileSystem video files with KnownFolders.VideosLibrary
and also the FutureAccessList
(which can make me access items outside the video library).
I want to save some data in reference to each StorageFile
object being used in my app. so for that first I thought of using SavePropertiesAsync
method to save metadata on properties of the storagefiles so that I can access them even if the file moves to some other location in the system, or if it gets deleted futureaccesslist will remove it automatically from itself. but I am getting ACCESS DENIED exception on SavePropertiesAsync()
method. and yes I am using VideoLibrary
capability in my app and I am attempting this method on a file which is within KnownFolder.VideoLibrary
.
Now that saveProperties isn't working, I am thinking of creating a database in my app and track the data by using FolderRelativeId
of StorageFile
and tracking the data against that property, because it is unique for each file even with same names. the only limitation in this scenario is that, folder related id changes when the files moves in filesystem, which cannot be notified to my app, (unless it is running, so I may use StorageLibraryTracker
api). Also if the file gets deleted, I won't know about that either.
So to summarize what is a property on a StorageFile
object which I can use to sync any custom metadata, between my file and that specific video file, obviously that property should remain same for that file, irrespective of where it moves in the filesystem.
This method should not throw this exception if you have enabled
VideoLibrary
capability. Check if your code snippet are correct, for example:If with correct code snippet and capability enabled you still get the
Access Denied
exception, the reason should be that the special file is setting with read only property. Please check this by right click the file and chooseProperties
, seeAttributes
.As you known ,you may use
StorageLibraryChange
relative APIs to tracker the file changes. Tracker the changes when the app in running should meet your requirements. But you could even know the changes when the app is not running by background tasks. You could register aStorageLibraryChangeTrackerTrigger
, when changes happened it will trigger a background task.