Vbscript 使用自定义名称创建pst文件
我正在使用下面的代码创建一个新的pst文件。但pst文件是使用Outlook中的默认名称“Outlook数据文件”创建的。我找不到任何选项来设置新pst文件的名称Vbscript 使用自定义名称创建pst文件,vbscript,outlook,Vbscript,Outlook,我正在使用下面的代码创建一个新的pst文件。但pst文件是使用Outlook中的默认名称“Outlook数据文件”创建的。我找不到任何选项来设置新pst文件的名称 Set objNS = objOutlook.GetNamespace("MAPI") objNS.AddStoreEx "C:\Users\pitarr\Documents\Outlook Files\f23.pst",2 尝试调用您添加的数据存储返回的PropertyAccessor对象的SetProperty方法。例如: Co
Set objNS = objOutlook.GetNamespace("MAPI")
objNS.AddStoreEx "C:\Users\pitarr\Documents\Outlook Files\f23.pst",2
尝试调用您添加的数据存储返回的PropertyAccessor对象的SetProperty方法。例如:
Const PR_DISPLAY_NAME = "http://schemas.microsoft.com/mapi/proptag/0x3001001F"
Dim oStore, oPA
For Each oStore in objNS.Stores
If oStore.FilePath = "C:\Users\pitarr\Documents\Outlook Files\f23.pst" Then
Set oPA = oStore.PropertyAccessor
oPA.SetProperty PR_DISPLAY_NAME, "SomeNewName"
End If
Next
否则,请查看重命名存储的根文件夹是否足够,正如Lankymart所建议的:
Dim oStore, oFolder
For Each oStore in objNS.Stores
If oStore.FilePath = "C:\Users\pitarr\Documents\Outlook Files\f23.pst" Then
Set oFolder = oStore.GetRootFolder()
oFolder.Name = "SomeNewName"
End If
Next
顺便说一句,以上两个示例都未经测试,可能取决于所使用的编码
希望这有帮助。尝试调用您添加的数据存储返回的PropertyAccessor对象的SetProperty方法。例如:
Const PR_DISPLAY_NAME = "http://schemas.microsoft.com/mapi/proptag/0x3001001F"
Dim oStore, oPA
For Each oStore in objNS.Stores
If oStore.FilePath = "C:\Users\pitarr\Documents\Outlook Files\f23.pst" Then
Set oPA = oStore.PropertyAccessor
oPA.SetProperty PR_DISPLAY_NAME, "SomeNewName"
End If
Next
否则,请查看重命名存储的根文件夹是否足够,正如Lankymart所建议的:
Dim oStore, oFolder
For Each oStore in objNS.Stores
If oStore.FilePath = "C:\Users\pitarr\Documents\Outlook Files\f23.pst" Then
Set oFolder = oStore.GetRootFolder()
oFolder.Name = "SomeNewName"
End If
Next
顺便说一句,以上两个示例都未经测试,可能取决于所使用的编码
希望这有帮助。根据-“如果您只想更改名称,用户可以在Outlook中看到新商店,只需更改商店默认文件夹的名称即可”。根据-“如果您只想更改名称,用户会在Outlook中看到新商店,只需更改商店的Defaultfolder的名称
就足够了”。做得好,您遵循了好,这是我期望OP做的。做得好,您遵循了好,这是我期望OP做的。