![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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. |
Ads |
#2
|
|||
|
|||
![]()
First get the storeID of the PST you want, then use the code in the link
below to get the path of the PST. At this point I think that you can continue ![]() http://www.outlookcode.com/codedetail.aspx?id=1434 "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. |
#3
|
|||
|
|||
![]()
Thanks for your reply.
May I have the sample code about how to get the storeID, cause I am a fresh in outlook coding. Cause there are different PST names of different people, may be the storeID is different. So I wanna it be universal to get all the active PST in user's outlook. Thanks. "MON205" wrote: First get the storeID of the PST you want, then use the code in the link below to get the path of the PST. At this point I think that you can continue ![]() http://www.outlookcode.com/codedetail.aspx?id=1434 "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. |
#4
|
|||
|
|||
![]()
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. |
#5
|
|||
|
|||
![]()
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. |
#6
|
|||
|
|||
![]()
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. |
#7
|
|||
|
|||
![]()
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. |
#8
|
|||
|
|||
![]()
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. |
#9
|
|||
|
|||
![]()
Do you mean that you successfully get paths forsome PSTs but others no?!!
Are they all in the same path? I don't know if the path starts ALWAYS from the character 107 (or 108). Try the same code in the article (search for the last "00000000"). If this doesn't work, post the storeid of the PST that you have troubles with -if u want-. "KAKA" wrote: 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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Delete based on Attachment Size (Item.Size)... | [email protected] | Outlook and VBA | 3 | August 27th 07 04:30 PM |
Outlook and Active Directory | MV | Outlook - General Queries | 0 | April 6th 06 06:57 PM |
Font size stuck on size 12 when creating new message. | Rob153 | Outlook Express | 13 | April 4th 06 01:29 PM |
Outlook and Active Directory | MV | Outlook - Installation | 0 | March 16th 06 11:20 PM |
Outlook and Active Directory | MV | Outlook - General Queries | 2 | March 15th 06 09:14 PM |