必须有一种方法可以使用MAPI执行此操作。
我有
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox);
$inbox.Folders `
| ? name -eq Subfolder1 `
| % Items
必须有一种方法可以在完整脚本运行后删除此子文件夹文件夹的内容,因此子文件夹将在下次运行脚本时清除,以便仅处理新项目时的项目。 (以便不处理文件重新处理)。有什么想法吗?
答案 0 :(得分:1)
只需使用删除方法:
class ElidingLineEdit( QLineEdit ) :
"""Eliding text lineedit
"""
def __init__( self, text = QString(), parent = None ) :
"""Class initialiser
"""
QLineEdit.__init__( self, parent )
self.mText = text;
self.fm = QFontMetrics( self.font() )
self.textEdited[ QString ].connect( self.saveText )
self.editingFinished.connect( self.shortenText )
def setText( self, txt ) :
"""setText( QString ) -> None
Override the QLineEdit::setText to display the shortened text
@return None
"""
QLineEdit.setText( self, self.fm.elidedText( self.mText, Qt.ElideRight, self.width() ) )
def resizeEvent( self, rEvent ) :
"""resizeEvent( QResizeEvent ) -> None
Override the resizeevent to shorten the text
@return None
"""
QLineEdit.setText( self, self.fm.elidedText( self.mText, Qt.ElideRight, rEvent.size().width() ) )
rEvent.accept()
def saveText( self, newText ) :
"""saveText() -> None
Save the text as it is changing
@return None
"""
self.mText = newText
def shortenText( self ) :
"""saveText() -> None
Save the text as it is changing
@return None
"""
QLineEdit.setText( self, self.fm.elidedText( self.mText, Qt.ElideRight, self.width() ) )
删除所有包含内容的子文件夹:
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder('olFolderInbox')
$SubFolders = $inbox.Folders
仅删除内容
$SubFolders | % {$_.Delete()}
foreach ($SubFolder in $SubFolders)
{
While ($Subfolder.Items.Count -ne 0)
{
$SubFolder.Items | % {$_.delete()}
}
}
来解决,就像示例