How to retrieve and update full file property?

SmilingMoon 981 Reputation points


Developing uwp app to update property of photo files,
I cannot find a way to update the properties marked red rectangle such as "ISO Speed". I can do it via Windows Explorer. How can I do it in uwp?

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Yan Gu - MSFT 2,671 Reputation points


    Welcome to Microsoft Q&A Case.

    For retrieving the properties of photo file, you can check the following steps.

    1.Create a list of strings and add the identifier for each property you want to retrieve.
    2.Call ImageProperties.RetrievePropertiesAsync method, which takes this list of strings and returns a dictionary of key/value pairs.
    Reference: Image MetaData

    public async void Access()  
                var folder = KnownFolders.PicturesLibrary;  
                StorageFile imageFile = await folder.GetFileAsync("test1.jpg");  
                if (imageFile!=null)  
                    ImageProperties props = await imageFile.Properties.GetImagePropertiesAsync();            
                    var requests = new System.Collections.Generic.List<string>();  
    IDictionary<string, object> retrievedProps = await props.RetrievePropertiesAsync(requests);  
    if (retrievedProps.ContainsKey("System.Photo.ISOSpeed"))  
                        var exifVersion = retrievedProps["System.Photo.ISOSpeed"];  

    For update the properties of photo file, you can use SavePropertiesAsync() method.

    ImageProperties props = await imageFile.Properties.GetImagePropertiesAsync();  
    var keyvalue = new KeyValuePair<string, object>("System.Photo.ISOSpeed", 100);  
    var properties = new List<KeyValuePair<string, object>>() { keyvalue };  
    await props.SavePropertiesAsync(properties);  

    The sample only shows the retrieval and update of “ISOSpeed” property. If you want to know more properties, please refer to the following document. System.Photo

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful