PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Form Programming
Programmatically adding contacts to a folder causes PST to grow exponentially
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Form Programming
Programmatically adding contacts to a folder causes PST to grow exponentially
![]() |
Programmatically adding contacts to a folder causes PST to grow exponentially |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I have a custom contact folder that also has contact subfolders. I've
installed a custom contact form and made it the default for these contact folders. The problem I'm seeing is that when I programmatically add about 450 contacts to 4 of those contact folders that the size of the PST file grows to about 20 MB in size. Why is this happening? This is especially puzzling since if I take those contacts and just copy the 450 contacts into 4 of those contact folders manually through the Outlook interface, the size of the PST ends up being only about 3.5 MB. Those contacts I copy in are using the same custom contact form as when I add them programmatically and if I look at the size of the contacts they are the same size as the ones I copied manually. Initiating the Compact Now does shrink the size of the PST from 20 MB to 7 MB. Is there any way to initiate this command programmatically? One further question when deleting contacts from a folder is it possible to stop them from going to the deleted items folder? Thanks Tim |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Show the code you're using to copy the contacts. What's the average size of
one of the contact items using a custom form? Outlook provides no way to compact a .pst file programmatically. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Tim" <Tim@sdfldsj.com> wrote in message news:uuybMm3jEHA.1560@TK2MSFTNGP10.phx.gbl... >I have a custom contact folder that also has contact subfolders. I've >installed a custom contact form and made it the default for these contact >folders. The problem I'm seeing is that when I programmatically add about >450 contacts to 4 of those contact folders that the size of the PST file >grows to about 20 MB in size. Why is this happening? > > This is especially puzzling since if I take those contacts and just copy > the 450 contacts into 4 of those contact folders manually through the > Outlook interface, the size of the PST ends up being only about 3.5 MB. > Those contacts I copy in are using the same custom contact form as when I > add them programmatically and if I look at the size of the contacts they > are the same size as the ones I copied manually. > > Initiating the Compact Now does shrink the size of the PST from 20 MB to 7 > MB. Is there any way to initiate this command programmatically? |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Either use CDO to perform the deletion or move the item to the Deleted Items
folder, then delete the moved item. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Tim" <Tim@sdfldsj.com> wrote in message news:uuybMm3jEHA.1560@TK2MSFTNGP10.phx.gbl... > > One further question when deleting contacts from a folder is it possible > to stop them from going to the deleted items folder? |
|
|
|
#4 |
|
Guest
Posts: n/a
|
The average size of the contacts are about 2 KB with each folder being about
861 KB which works out to be about what it was when I copied the contacts through the Outlook interface. To me it appears the process of saving the contact causes a lot of internal work to be done inside the PST which causes the growth although I don't know what that would be and why its any different than creating then through the interface. In the code I'm not copying the contacts but retrieving them from a customer SharePoint list and saving them separately into each contact subfolder based on a custom keywords list field. I found that sorting the contacts by a custom keywords list field and them copying them actually took longer (at least the way I coded) than using this approach. Nevertheless the size of the PST file increased in both ways. This is the basis of the code although I've stripped out all the contact fields to make it readable. For intRow = 0 To myRowsMod.GetUpperBound(0) oContact = oFolder.Items.Add With oContact 'Parse items from SharePoint and add them to the appropriate Contact fields End Select 'Finally, save the ContactItem .Save() End With Next "Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message news:uDK8n33jEHA.396@TK2MSFTNGP12.phx.gbl... > Show the code you're using to copy the contacts. What's the average size > of > one of the contact items using a custom form? > > Outlook provides no way to compact a .pst file programmatically. > -- > Sue Mosher, Outlook MVP > Author of > Microsoft Outlook Programming - Jumpstart for > Administrators, Power Users, and Developers > http://www.outlookcode.com/jumpstart.aspx > > > "Tim" <Tim@sdfldsj.com> wrote in message > news:uuybMm3jEHA.1560@TK2MSFTNGP10.phx.gbl... >>I have a custom contact folder that also has contact subfolders. I've >>installed a custom contact form and made it the default for these contact >>folders. The problem I'm seeing is that when I programmatically add about >>450 contacts to 4 of those contact folders that the size of the PST file >>grows to about 20 MB in size. Why is this happening? >> >> This is especially puzzling since if I take those contacts and just copy >> the 450 contacts into 4 of those contact folders manually through the >> Outlook interface, the size of the PST ends up being only about 3.5 MB. >> Those contacts I copy in are using the same custom contact form as when I >> add them programmatically and if I look at the size of the contacts they >> are the same size as the ones I copied manually. >> >> Initiating the Compact Now does shrink the size of the PST from 20 MB to >> 7 >> MB. Is there any way to initiate this command programmatically? > > > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
I don't know why the PST might be growing like that but, frankly, it doesn't
sound like a real problem since the background compacting will eventually shrink it when the machine is idle. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Tim" <Tim@sdfldsj.com> wrote in message news:%231ivJJ4jEHA.3196@TK2MSFTNGP10.phx.gbl... > The average size of the contacts are about 2 KB with each folder being > about 861 KB which works out to be about what it was when I copied the > contacts through the Outlook interface. To me it appears the process of > saving the contact causes a lot of internal work to be done inside the PST > which causes the growth although I don't know what that would be and why > its any different than creating then through the interface. > > In the code I'm not copying the contacts but retrieving them from a > customer SharePoint list and saving them separately into each contact > subfolder based on a custom keywords list field. I found that sorting > the contacts by a custom keywords list field and them copying them > actually took longer (at least the way I coded) than using this approach. > Nevertheless the size of the PST file increased in both ways. > > This is the basis of the code although I've stripped out all the contact > fields to make it readable. > For intRow = 0 To myRowsMod.GetUpperBound(0) > > oContact = oFolder.Items.Add > > With oContact > > 'Parse items from SharePoint and add them to the appropriate > Contact fields > > End Select > > 'Finally, save the ContactItem > > .Save() > > End With > > Next >> >> "Tim" <Tim@sdfldsj.com> wrote in message >> news:uuybMm3jEHA.1560@TK2MSFTNGP10.phx.gbl... >>>I have a custom contact folder that also has contact subfolders. I've >>>installed a custom contact form and made it the default for these contact >>>folders. The problem I'm seeing is that when I programmatically add >>>about >>>450 contacts to 4 of those contact folders that the size of the PST file >>>grows to about 20 MB in size. Why is this happening? >>> >>> This is especially puzzling since if I take those contacts and just copy >>> the 450 contacts into 4 of those contact folders manually through the >>> Outlook interface, the size of the PST ends up being only about 3.5 MB. >>> Those contacts I copy in are using the same custom contact form as when >>> I >>> add them programmatically and if I look at the size of the contacts they >>> are the same size as the ones I copied manually. >>> >>> Initiating the Compact Now does shrink the size of the PST from 20 MB to >>> 7 >>> MB. Is there any way to initiate this command programmatically? >> >> >> >> > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

