microsoft.public.scripting.vbscript - Microsoft Office Project
I need to obtain the extended file properties, such as Owner, Title, etc, for a file in a .net program. I have looked through the FileInfo class and I cannot see any methods or properties that will expose this. In the old days we used to use GetFileInfo but I don't see it in .Net anywhere. How can I get this information? Thanks, T
I have searched the forum for tips on how to get extended file properties, but haven't had any luck yet. What I'm after specifically is version information, such as that found when a file is right-clicked in Windows Explorer, then under the Version tab. The number given for Product Version would be perfect. I need to get this information using only VBScript if possible. I know about GetDetailsOf, but have not been able to get that to give me version. It may be that what I'm trying to do is not possible. Also, is there a list somewhere that shows all the columns available with GetDetailsOf? I saw a page at Microsoft that only had 4 or 5, but I've seen some code that went up to 33 or so. Thanks in advance for any help.
Hi, Using some code I found on the web I can read the Extended file properties. Some of the properties are clearly read only, but how can I change the ones which aren't? <code> Function GetFileInformation() As Boolean On Error GoTo ErrorHandler Dim arrHeaders(35) Set objShell = CreateObject("Shell.Application") Set objfolder = objShell.Namespace("C:\TestFolder") For i = 0 To 34 arrHeaders(i) = objfolder.GetDetailsOf(objfolder.Items, i) Next For Each strFileName In objfolder.Items For i = 0 To 34 Debug.Print i & vbTab & arrHeaders(i) & ": " _ & objfolder.GetDetailsOf(strFileName, i) Next Next GetFileInformation = True Exit Function ErrorHandler: MsgBox "Unable to process data in Function 'GetFileInformation' due to:" & vbCrLf & Err.Description, vbCritical Err.Clear GetFileInformation = False End Function ' GetFileInformation </code> Regards Laurie Comerford
Is it possible to alter the extended (text) file properties, such as Title and Comments in code? Had a long search for this, but not found anything at all. There is no problem reading these properties: Function GetFileProperty(vFolder As Variant, _ strFile As String, _ Optional lIndex As Long, _ Optional strItemName As String) As String Dim i As Long Dim objShell As Object Dim objFolder As Object Dim objFolderItem As Object Dim arrHeaders(41) Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(vFolder) Set objFolderItem = objFolder.ParseName(strFile) If Len(strItemName) > 0 Then For i = 0 To 40 arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i) If arrHeaders(i) = strItemName Then lIndex = i Exit For End If Next End If GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex) End Function Sub test() MsgBox GetFileProperty("C:\test\", "test.txt", , "Comments") End Sub If there is no way to set these properties in code then is there another way to mark a text file in such a way that it won't be changed by a save or write of the file? RBS