メソッドを使用して、ファイルの事前定義されたプロパティを取得できることを知っていますRetrievePropertiesAsync()
。しかし、説明のような独自のカスタム プロパティをもう 1 つ追加したいのですが、可能ですか? このコードを試しましたが、例外が発生しました
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
StorageFile file = await KnownFolders.MusicLibrary.GetFileAsync("video.mp4");
List<string> propertiesName = new List<string>();
propertiesName.Add("CustomProperty");
string a = "Come and knock on our door. We've been waiting for you. Where the kisses are hers and hers and his, three's company, too! Come and dance on our floor. Take a step that is new. We've a lovable space that needs your face, three's company, too! You'll see that life is a ball again and laughter is callin' for you. Down at our rendezvous, three's company, too! The year is 1987 and NASA launches the last of America's deep space probes. In a freak mishap, Ranger 3 and its pilot Captain William 'Buck' Rogers are blown out of their trajectory into an orbit which freezes his life support system and returns Buck Rogers to Earth five hundred years later.";
IDictionary<string, object> extraProperties = await file.Properties.RetrievePropertiesAsync(propertiesName);
extraProperties.Add((new KeyValuePair<string, object>("CustomProperty", a)));
await file.Properties.SavePropertiesAsync(extraProperties);
}
An exception of type 'System.ArgumentException' occurred in App2.exe but was not handled in user code
WinRT information: The specified property name (CustomProperty) is invalid. The property may not be registered on the system.
Additional information: The parameter is incorrect.
PS :このようなものが欲しい