Read extended properties of a file in C#
You need to make a reference to the COM library “Microsoft Shell controls and automation”
[STAThread]
public static void Main(string[] args)
{
List<string> arrHeaders = new List<string>();
Shell32.Shell shell = new Shell32.Shell();
var strFileName = @”C:\Users\Fiach\Desktop\sample_iTunes.mov”;
Shell32.Folder objFolder = shell.NameSpace(System.IO.Path.GetDirectoryName(strFileName));
Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(strFileName));
for (int i = 0; i < short.MaxValue; i++)
{
string header = objFolder.GetDetailsOf(null, i);
if (String.IsNullOrEmpty(header))
break;
arrHeaders.Add(header);
}
for (int i = 0; i < arrHeaders.Count; i++)
{
Console.WriteLine(“{0}\t{1}: {2}”, i, arrHeaders[i], objFolder.GetDetailsOf(folderItem, i));
}
Console.ReadLine();
}
Sample output:
0 Name: 8202_maxoperatorrender2min.mov
1 Size: 2.67 MB
2 Item type: QuickTime Movie
3 Date modified: 09/12/2014 13:48
4 Date created: 18/11/2014 09:54
5 Date accessed: 18/11/2014 09:54
6 Attributes: A
7 Offline status:
8 Offline availability:
9 Perceived type: Video
10 Owner: Windows7Fiach\Fiach
11 Kind: Video
12 Date taken:
13 Contributing artists:
14 Album:
15 Year:
16 Genre:
17 Conductors:
18 Tags:
19 Rating: Unrated
20 Authors:
21 Title:
22 Subject:
23 Categories:
24 Comments:
25 Copyright:
26 #:
27 Length: 00:00:02
28 Bit rate:
29 Protected: No
30 Camera model:
31 Dimensions:
32 Camera maker:
33 Company:
34 File description:
35 Program name:
36 Duration:
37 Is online:
38 Is recurring:
39 Location:
40 Optional attendee addresses:
41 Optional attendees:
42 Organizer address:
43 Organizer name:
44 Reminder time:
45 Required attendee addresses:
46 Required attendees:
47 Resources:
48 Meeting status:
49 Free/busy status:
50 Total size:
51 Account name:
52 Task status:
53 Computer: WINDOWS7FIACH (this computer)
54 Anniversary:
55 Assistant’s name:
56 Assistant’s phone:
57 Birthday:
58 Business address:
59 Business city:
60 Business country/region:
61 Business P.O. box:
62 Business postal code:
63 Business state or province:
64 Business street:
65 Business fax:
66 Business home page:
67 Business phone:
68 Callback number:
69 Car phone:
70 Children:
71 Company main phone:
72 Department:
73 E-mail address:
74 E-mail2:
75 E-mail3:
76 E-mail list:
77 E-mail display name:
78 File as:
79 First name:
80 Full name:
81 Gender:
82 Given name:
83 Hobbies:
84 Home address:
85 Home city:
86 Home country/region:
87 Home P.O. box:
88 Home postal code:
89 Home state or province:
90 Home street:
91 Home fax:
92 Home phone:
93 IM addresses:
94 Initials:
95 Job title:
96 Label:
97 Last name:
98 Mailing address:
99 Middle name:
100 Cell phone:
101 Nickname:
102 Office location:
103 Other address:
104 Other city:
105 Other country/region:
106 Other P.O. box:
107 Other postal code:
108 Other state or province:
109 Other street:
110 Pager:
111 Personal title:
112 City:
113 Country/region:
114 P.O. box:
115 Postal code:
116 State or province:
117 Street:
118 Primary e-mail:
119 Primary phone:
120 Profession:
121 Spouse/Partner:
122 Suffix:
123 TTY/TTD phone:
124 Telex:
125 Webpage:
126 Content status:
127 Content type:
128 Date acquired:
129 Date archived:
130 Date completed:
131 Device category:
132 Connected:
133 Discovery method:
134 Friendly name:
135 Local computer:
136 Manufacturer:
137 Model:
138 Paired:
139 Classification:
140 Status:
141 Client ID:
142 Contributors:
143 Content created:
144 Last printed:
145 Date last saved:
146 Division:
147 Document ID:
148 Pages:
149 Slides:
150 Total editing time:
151 Word count:
152 Due date:
153 End date:
154 File count:
155 Filename: 8202_maxoperatorrender2min.mov
156 File version:
157 Flag color:
158 Flag status:
159 Space free:
160 Bit depth:
161 Horizontal resolution:
162 Width:
163 Vertical resolution:
164 Height:
165 Importance:
166 Is attachment:
167 Is deleted:
168 Encryption status:
169 Has flag:
170 Is completed:
171 Incomplete:
172 Read status:
173 Shared: No
174 Creators:
175 Date:
176 Folder name: vidthumb
177 Folder path: C:\research\vidthumb
178 Folder: vidthumb (C:\research)
179 Participants:
180 Path: C:\research\vidthumb\8202_maxoperatorrender2min.mov
181 By location:
182 Type: QuickTime Movie
183 Contact names:
184 Entry type:
185 Language:
186 Date visited:
187 Description:
188 Link status: Unresolved
189 Link target:
190 URL:
191 Media created:
192 Date released:
193 Encoded by:
194 Producers:
195 Publisher:
196 Subtitle:
197 User web URL:
198 Writers:
199 Attachments:
200 Bcc addresses:
201 Bcc:
202 Cc addresses:
203 Cc:
204 Conversation ID:
205 Date received:
206 Date sent:
207 From addresses:
208 From:
209 Has attachments:
210 Sender address:
211 Sender name:
212 Store:
213 To addresses:
214 To do title:
215 To:
216 Mileage:
217 Album artist:
218 Album ID:
219 Beats-per-minute:
220 Composers:
221 Initial key:
222 Part of a compilation:
223 Mood:
224 Part of set:
225 Period:
226 Color:
227 Parental rating:
228 Parental rating reason:
229 Space used:
230 EXIF version:
231 Event:
232 Exposure bias:
233 Exposure program:
234 Exposure time:
235 F-stop:
236 Flash mode:
237 Focal length:
238 35mm focal length:
239 ISO speed:
240 Lens maker:
241 Lens model:
242 Light source:
243 Max aperture:
244 Metering mode:
245 Orientation:
246 People:
247 Program mode:
248 Saturation:
249 Subject distance:
250 White balance:
251 Priority:
252 Project:
253 Channel number:
254 Episode name:
255 Closed captioning:
256 Rerun:
257 SAP:
258 Broadcast date:
259 Program description:
260 Recording time:
261 Station call sign:
262 Station name:
263 Summary:
264 Snippets:
265 Auto summary:
266 Search ranking:
267 Sensitivity:
268 Shared with:
269 Sharing status: Not shared
270 Product name:
271 Product version:
272 Support link:
273 Source:
274 Start date:
275 Billing information:
276 Complete:
277 Task owner:
278 Total file size:
279 Legal trademarks:
280 Video compression: {706E6720-767A-494D-B478-F29D25DC9037}
281 Directors:
282 Data rate: ?11176kbps
283 Frame height:
284 Frame rate:
285 Frame width:
286 Total bitrate: ?11176kbps
LikeLike
An update (additional information): Since I found this article helpful I thought I would offer an update. Ran this concept over a small sampling of windows 10 computers and came up with the following list of folder properties:
id: 0 name: Name
id: 1 name: Size
id: 2 name: Item type
id: 3 name: Date modified
id: 4 name: Date created
id: 5 name: Date accessed
id: 6 name: Attributes
id: 7 name: Offline status
id: 8 name: Availability
id: 9 name: Perceived type
id: 10 name: Owner
id: 11 name: Kind
id: 12 name: Date taken
id: 13 name: Contributing artists
id: 14 name: Album
id: 15 name: Year
id: 16 name: Genre
id: 17 name: Conductors
id: 18 name: Tags
id: 19 name: Rating
id: 20 name: Authors
id: 21 name: Title
id: 22 name: Subject
id: 23 name: Categories
id: 24 name: Comments
id: 25 name: Copyright
id: 26 name: #
id: 27 name: Length
id: 28 name: Bit rate
id: 29 name: Protected
id: 30 name: Camera model
id: 31 name: Dimensions
id: 32 name: Camera maker
id: 33 name: Company
id: 34 name: File description
id: 35 name: Masters keywords
id: 36 name: Masters keywords
No Header for 37
No Header for 38
No Header for 39
No Header for 40
No Header for 41
id: 42 name: Program name
id: 43 name: Duration
id: 44 name: Is online
id: 45 name: Is recurring
id: 46 name: Location
id: 47 name: Optional attendee addresses
id: 48 name: Optional attendees
id: 49 name: Organizer address
id: 50 name: Organizer name
id: 51 name: Reminder time
id: 52 name: Required attendee addresses
id: 53 name: Required attendees
id: 54 name: Resources
id: 55 name: Meeting status
id: 56 name: Free/busy status
id: 57 name: Total size
id: 58 name: Account name
No Header for 59
id: 60 name: Task status
id: 61 name: Computer
id: 62 name: Anniversary
id: 63 name: Assistant’s name
id: 64 name: Assistant’s phone
id: 65 name: Birthday
id: 66 name: Business address
id: 67 name: Business city
id: 68 name: Business country/region
id: 69 name: Business P.O. box
id: 70 name: Business postal code
id: 71 name: Business state or province
id: 72 name: Business street
id: 73 name: Business fax
id: 74 name: Business home page
id: 75 name: Business phone
id: 76 name: Callback number
id: 77 name: Car phone
id: 78 name: Children
id: 79 name: Company main phone
id: 80 name: Department
id: 81 name: E-mail address
id: 82 name: E-mail2
id: 83 name: E-mail3
id: 84 name: E-mail list
id: 85 name: E-mail display name
id: 86 name: File as
id: 87 name: First name
id: 88 name: Full name
id: 89 name: Gender
id: 90 name: Given name
id: 91 name: Hobbies
id: 92 name: Home address
id: 93 name: Home city
id: 94 name: Home country/region
id: 95 name: Home P.O. box
id: 96 name: Home postal code
id: 97 name: Home state or province
id: 98 name: Home street
id: 99 name: Home fax
id: 100 name: Home phone
id: 101 name: IM addresses
id: 102 name: Initials
id: 103 name: Job title
id: 104 name: Label
id: 105 name: Last name
id: 106 name: Mailing address
id: 107 name: Middle name
id: 108 name: Cell phone
id: 109 name: Nickname
id: 110 name: Office location
id: 111 name: Other address
id: 112 name: Other city
id: 113 name: Other country/region
id: 114 name: Other P.O. box
id: 115 name: Other postal code
id: 116 name: Other state or province
id: 117 name: Other street
id: 118 name: Pager
id: 119 name: Personal title
id: 120 name: City
id: 121 name: Country/region
id: 122 name: P.O. box
id: 123 name: Postal code
id: 124 name: State or province
id: 125 name: Street
id: 126 name: Primary e-mail
id: 127 name: Primary phone
id: 128 name: Profession
id: 129 name: Spouse/Partner
id: 130 name: Suffix
id: 131 name: TTY/TTD phone
id: 132 name: Telex
id: 133 name: Webpage
id: 134 name: Content status
id: 135 name: Content type
id: 136 name: Date acquired
id: 137 name: Date archived
id: 138 name: Date completed
id: 139 name: Device category
id: 140 name: Connected
id: 141 name: Discovery method
id: 142 name: Friendly name
id: 143 name: Local computer
id: 144 name: Manufacturer
id: 145 name: Model
id: 146 name: Paired
id: 147 name: Classification
id: 148 name: Status
id: 149 name: Status
id: 150 name: Client ID
id: 151 name: Contributors
id: 152 name: Content created
id: 153 name: Last printed
id: 154 name: Date last saved
id: 155 name: Division
id: 156 name: Document ID
id: 157 name: Pages
id: 158 name: Slides
id: 159 name: Total editing time
id: 160 name: Word count
id: 161 name: Due date
id: 162 name: End date
id: 163 name: File count
id: 164 name: File extension
id: 165 name: Filename
id: 166 name: File version
id: 167 name: Flag color
id: 168 name: Flag status
id: 169 name: Space free
No Header for 170
No Header for 171
id: 172 name: Group
id: 173 name: Sharing type
id: 174 name: Bit depth
id: 175 name: Horizontal resolution
id: 176 name: Width
id: 177 name: Vertical resolution
id: 178 name: Height
id: 179 name: Importance
id: 180 name: Is attachment
id: 181 name: Is deleted
id: 182 name: Encryption status
id: 183 name: Has flag
id: 184 name: Is completed
id: 185 name: Incomplete
id: 186 name: Read status
id: 187 name: Shared
id: 188 name: Creators
id: 189 name: Date
id: 190 name: Folder name
id: 191 name: Folder path
id: 192 name: Folder
id: 193 name: Participants
id: 194 name: Path
id: 195 name: By location
id: 196 name: Type
id: 197 name: Contact names
id: 198 name: Entry type
id: 199 name: Language
id: 200 name: Date visited
id: 201 name: Description
id: 202 name: Link status
id: 203 name: Link target
id: 204 name: URL
No Header for 205
No Header for 206
No Header for 207
id: 208 name: Media created
id: 209 name: Date released
id: 210 name: Encoded by
id: 211 name: Episode number
id: 212 name: Producers
id: 213 name: Publisher
id: 214 name: Season number
id: 215 name: Subtitle
id: 216 name: User web URL
id: 217 name: Writers
No Header for 218
id: 219 name: Attachments
id: 220 name: Bcc addresses
id: 221 name: Bcc
id: 222 name: Cc addresses
id: 223 name: Cc
id: 224 name: Conversation ID
id: 225 name: Date received
id: 226 name: Date sent
id: 227 name: From addresses
id: 228 name: From
id: 229 name: Has attachments
id: 230 name: Sender address
id: 231 name: Sender name
id: 232 name: Store
id: 233 name: To addresses
id: 234 name: To do title
id: 235 name: To
id: 236 name: Mileage
id: 237 name: Album artist
id: 238 name: Sort album artist
id: 239 name: Album ID
id: 240 name: Sort album
id: 241 name: Sort contributing artists
id: 242 name: Beats-per-minute
id: 243 name: Composers
id: 244 name: Sort composer
id: 245 name: Disc
id: 246 name: Initial key
id: 247 name: Part of a compilation
id: 248 name: Mood
id: 249 name: Part of set
id: 250 name: Period
id: 251 name: Color
id: 252 name: Parental rating
id: 253 name: Parental rating reason
id: 254 name: Space used
id: 255 name: EXIF version
id: 256 name: Event
id: 257 name: Exposure bias
id: 258 name: Exposure program
id: 259 name: Exposure time
id: 260 name: F-stop
id: 261 name: Flash mode
id: 262 name: Focal length
id: 263 name: 35mm focal length
id: 264 name: ISO speed
id: 265 name: Lens maker
id: 266 name: Lens model
id: 267 name: Light source
id: 268 name: Max aperture
id: 269 name: Metering mode
id: 270 name: Orientation
id: 271 name: People
id: 272 name: Program mode
id: 273 name: Saturation
id: 274 name: Subject distance
id: 275 name: White balance
id: 276 name: Priority
id: 277 name: Project
id: 278 name: Channel number
id: 279 name: Episode name
id: 280 name: Closed captioning
id: 281 name: Rerun
id: 282 name: SAP
id: 283 name: Broadcast date
id: 284 name: Program description
id: 285 name: Recording time
id: 286 name: Station call sign
id: 287 name: Station name
id: 288 name: Summary
id: 289 name: Snippets
id: 290 name: Auto summary
id: 291 name: Relevance
id: 292 name: File ownership
id: 293 name: Sensitivity
id: 294 name: Shared with
id: 295 name: Sharing status
No Header for 296
id: 297 name: Product name
id: 298 name: Product version
id: 299 name: Support link
id: 300 name: Source
id: 301 name: Start date
id: 302 name: Sharing
id: 303 name: Availability status
id: 304 name: Status
id: 305 name: Billing information
id: 306 name: Complete
id: 307 name: Task owner
id: 308 name: Sort title
id: 309 name: Total file size
id: 310 name: Legal trademarks
id: 311 name: Video compression
id: 312 name: Directors
id: 313 name: Data rate
id: 314 name: Frame height
id: 315 name: Frame rate
id: 316 name: Frame width
id: 317 name: Spherical
id: 318 name: Stereo
id: 319 name: Video orientation
id: 320 name: Total bitrate
LikeLike