Var propValue = extraProperties įileProperties.AppendLine("Date accessed: " + propValue) Define property names to be retrieved.Īwait (propertyNames) Var folder = KnownFolders.PicturesLibrary Enumerate all files in the Pictures library. const string dateAccessedProperty = "System.DateAccessed" Ĭonst string fileOwnerProperty = "System.FileOwner" See the Windows Core Properties for a complete list of a file's extended properties. This example enumerates all of the files in the Pictures library, specifies the names of desired properties ( DataAccessed and FileOwner) in a List object, passes that List object to BasicProperties.RetrievePropertiesAsync to retrieve those properties, and then retrieves those properties by name from the returned IDictionary object. Each extended property is then retrieved from the collection by name or by index. This method then returns an IDictionary collection. (A BasicProperties object is obtained by calling the StorageFile.Properties property.) While top-level and basic file properties are accessible as properties of a class- StorageFile and BasicProperties, respectively-extended properties are obtained by passing an IEnumerable collection of String objects representing the names of the properties that are to be retrieved to the BasicProperties.RetrievePropertiesAsync method. These extended properties are accessed by calling the BasicProperties.RetrievePropertiesAsync method. String fileSize = string.Format("", basicProperties.Size) įileProperties.AppendLine("File size: " + fileSize + " bytes") įileProperties.AppendLine("Date modified: " + basicProperties.DateModified) Īside from the top-level and basic file properties, there are many properties associated with the file's contents. This example enumerates all of the files in the Pictures library, accessing a few of each file's basic properties. This method returns a BasicProperties object, which defines properties for the size of the item (file or folder) as well as when the item was last modified. Many basic file properties are obtained by first calling the StorageFile.GetBasicPropertiesAsync method. StringBuilder fileProperties = new StringBuilder() įileProperties.AppendLine("File name: " + file.Name) įileProperties.AppendLine("File type: " + file.FileType) This example enumerates all of the files in the Pictures library, accessing a few of each file's top-level properties. Remember to declare the picturesLibrary capability.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |