How can I get the active pst size mounted in outlook ?
Hi MON205, thanks for your suggestion. I use the following code to get the
path, but the result of some PST path is invalid, some is valid, it
confuses me a lot. Cause I can get the name in the code without path.
-------
Sub getStores()
Dim objSession As MAPI.Session
Dim objInfoStoresColl As InfoStores
Dim objInfoStore As InfoStore
Dim infS As InfoStore
Dim objFSO As FileSystemObject
Dim objFile As File
Dim PSTSize As Long
Set objSession = CreateObject("MAPI.Session")
objSession.Logon showdialog:=False, newsession:=False
Set objInfoStoresColl = objSession.InfoStores
If objInfoStoresColl Is Nothing Then
MsgBox "Could not set InfoStores collection"
Exit Sub
End If
If 0 = objInfoStoresColl.Count Then
MsgBox "No InfoStores in the collection"
Exit Sub
End If
Dim thePath As String
For i = 1 To objInfoStoresColl.Count
Set objInfoStore = objInfoStoresColl(i)
Dim j As Integer, magicNumber As Integer
magicNumber = 107
thePath = ""
For j = magicNumber To Len(objInfoStore.ID) - 2 Step 2
thePath = thePath & Chr(CInt("&H" & Mid(objInfoStore.ID, j, 2)))
Next j
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(thePath)
PSTSize = objFile.Size / 1024
PSTSize = PSTSize / 1024
MsgBox "i= " & i & Chr(10) & _
"PST File Name= " & objInfoStoresColl(i).Name & Chr(10) & thePath
& Chr(10) & PSTSize & "MB"
Next i
Set objInfoStoresColl = Nothing
objSession.Logoff
End Sub
--------
"MON205" wrote:
Hi KAKA…
Don’t hesitate to post any question you want. This is a good forum to post
questions in it.
Ideas here are public to all, and this forum helps a lot of people in their
tasks. I’m not sure that I can respond faster if you contacted me directly.
Another thing, you can say that I’m beginner here. I’m asking questions just
like you. Here you can find professionals that may help you more than I can.
Just as I told you, post any question you want, and ask about any thing you
can’t understand. We are all here to share efforts and to support each other.
"KAKA" wrote:
Hi MON205, thaks for your guiding. May I have your mail address for
communicating directly ?
"MON205" wrote:
In your add-in, you have the "Outlook::_Application", from this point, use
the sequence below:
Outlook::_NameSpacePtr pMapi = spApp-GetNamespace( _bstr_t( "MAPI" ) );
_FoldersPtr pFoldersCollection = pMapi-get_Folders( & pFoldersCollection );
MAPIFolderPtr pFolder = NULL;
BSTR bstrStoreID;
long lFoldersCount = pFoldersCollection-GetCount( );
pFolder = pFoldersCollection-GetFirst( );
// Loop for PST's
for( long lIndex = 0; lIndex lFoldersCount; lIndex++ )
{
pFolder-get_StoreID( & bstrStoreID );
pFolder = pFoldersCollection-GetNext( );
// Here you have the StoreID for this PST
// Use the code in the web site I sent you to get the PST file path from
// thisStoreID
// Now after you have the file path, let it be strPSTFilePath
// Call OpenFile, then GetFileSizeEx, and don't forget calling
CloseHandle()
// to close the file handle
}
... I hope this helps you
"KAKA" wrote:
Hi, MON205, could you please give me a farther guide ? I'm in emergency. And
anybody could answer my question ?
"KAKA" wrote:
Hi, I had a question. How can I get the active pst size mounted in outlook ?
Using vbscript or add-in. I tried to get the size , but there is no such
parameter. Thanks.
|