StorageItem.Delete 方法 (Outlook)

从父文件夹中永久删除 StorageItem 对象。

语法

表达式删除

表达 一个代表 StorageItem 对象的变量。

备注

此调用使清理或重置为其私有数据的存储解决方案。 试图删除已删除以前的 StorageItem.Delete 通过 邮件 调用将导致错误,"无法完成删除操作"。

有关删除 StorageItem 对象中存储的解决方案数据的详细信息,请参阅更新和删除解决方案存储

示例

在 Visual Basic for Applications 下面的代码示例演示如何清除已指定的主题,具有相同的主题中创建的新实例,将值分配给自定义属性,并保存新实例的任何现有 邮件 对象。

Sub AssignStorageData() 
 
 Dim oInbox As Outlook.Folder 
 
 Dim myStorage As Outlook.StorageItem 
 
 
 
 Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox) 
 
 ' Remove and reset any existing instance of StorageItem of the specified subject 
 
 Set myStorage = oInbox.GetStorage("My Private Storage", olIdentifyBySubject) 
 
 myStorage.Delete 
 
 Set myStorage = Nothing 
 
 ' Get a new instance of StorageItem 
 
 Set myStorage = oInbox.GetStorage("My Private Storage", olIdentifyBySubject) 
 
 myStorage.UserProperties.Add "Order Number", olNumber 
 
 myStorage.UserProperties("Order Number").Value = 1000 
 
 myStorage.Save 
 
End Sub

另请参阅

StorageItem 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。