![]() |
| 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. |
|
|||||||
| Tags: automation, memory, out, outlook, problem |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I'm not sure if I am posting to the right forum but I am having a problem
with accessing Contacts with Outlook Automation. The program works perfect in Outlook 2003 but gives an error on another computer with Outlook 2002. When I try and access the .Body I get an OLE Dispatch Error Code 4096 From Microsoft Outlook Out Of Memory. I'm not sure if the problem is with Outlook, the computer or perhaps I could change my programming code and how I access the body in Outlook Contacts. The code that gives the error is in VFP but it should be similar to VB so here's a snapshot if it helps. I don't think it is a coding problem but I'm thinking perhaps there might be another way to access the body which might not give this error. loOutlook = createobject('outlook.application') loNS = loOutlook.GetNameSpace('MAPI') loDF = loNS.GetDefaultFolder(olFolderContacts) loItems = loDF.items loItem = loItems.item(1) ? loItem.Body Also, does anyone know offhand how to access the Email field(s). Thanks, Mike |
| Ads |
|
#2
|
|||
|
|||
|
If you are accessing Body in Outlook 2002 you are running into the Outlook
object model security. See http://www.outlookcode.com/article.aspx?id=52 for an explanation and workarounds. The email fields are also restricted and subject to the security. They are item.EmailNAddress where N is a number from 1 to 3. If the user is on Exchange server the email address or addresses corresponding to an Exchange address won't have an SMTP format it will be returned in an Exchange distinguished name format. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "MikeA" wrote in message news:QKspi.3693$7w.868@trnddc05... I'm not sure if I am posting to the right forum but I am having a problem with accessing Contacts with Outlook Automation. The program works perfect in Outlook 2003 but gives an error on another computer with Outlook 2002. When I try and access the .Body I get an OLE Dispatch Error Code 4096 From Microsoft Outlook Out Of Memory. I'm not sure if the problem is with Outlook, the computer or perhaps I could change my programming code and how I access the body in Outlook Contacts. The code that gives the error is in VFP but it should be similar to VB so here's a snapshot if it helps. I don't think it is a coding problem but I'm thinking perhaps there might be another way to access the body which might not give this error. loOutlook = createobject('outlook.application') loNS = loOutlook.GetNameSpace('MAPI') loDF = loNS.GetDefaultFolder(olFolderContacts) loItems = loDF.items loItem = loItems.item(1) ? loItem.Body Also, does anyone know offhand how to access the Email field(s). Thanks, Mike |
|
#3
|
|||
|
|||
|
No - I don't think it is a security issue. I had them try and export the
calendar from my application to Outlook and it brings up the Outlook security dialog. I then had them enter 10 minutes so there would be plenty of time to then try and export contacts. It gets to around 110 of 700 contacts to export and then it errors out upon reading the body. I don't get it. It reads the body for the first 100+ contacts and then errors out and gives an "out of memory error." But, it seems to work just fine on my Outlook 2003 but not on their Outlook 2002. Mike "Ken Slovak - [MVP - Outlook]" wrote in message ... If you are accessing Body in Outlook 2002 you are running into the Outlook object model security. See http://www.outlookcode.com/article.aspx?id=52 for an explanation and workarounds. The email fields are also restricted and subject to the security. They are item.EmailNAddress where N is a number from 1 to 3. If the user is on Exchange server the email address or addresses corresponding to an Exchange address won't have an SMTP format it will be returned in an Exchange distinguished name format. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "MikeA" wrote in message news:QKspi.3693$7w.868@trnddc05... I'm not sure if I am posting to the right forum but I am having a problem with accessing Contacts with Outlook Automation. The program works perfect in Outlook 2003 but gives an error on another computer with Outlook 2002. When I try and access the .Body I get an OLE Dispatch Error Code 4096 From Microsoft Outlook Out Of Memory. I'm not sure if the problem is with Outlook, the computer or perhaps I could change my programming code and how I access the body in Outlook Contacts. The code that gives the error is in VFP but it should be similar to VB so here's a snapshot if it helps. I don't think it is a coding problem but I'm thinking perhaps there might be another way to access the body which might not give this error. loOutlook = createobject('outlook.application') loNS = loOutlook.GetNameSpace('MAPI') loDF = loNS.GetDefaultFolder(olFolderContacts) loItems = loDF.items loItem = loItems.item(1) ? loItem.Body Also, does anyone know offhand how to access the Email field(s). Thanks, Mike |
|
#4
|
|||
|
|||
|
Is this running against an Exchange server mailbox? If so it might be the
RPC channel limit. That's usually set to 255 and is set in the registry on the server. Once you exceed that number of open RPC channels you get various errors including out of memory errors. If you are looping to handle multiple items then that's likely the problem. The fixes are to eliminate usage of multiple dot operators so Outlook doesn't open internal variables for each dot operator, explicitly releasing your objects each pass through the loop to close their RPC channels and if necessary using a shorter loop called repeatedly. Normally any open internal variables aren't released until you exit the procedure where they were created as they go out of scope. In that case your loop procedure might have to be called repeatedly, say once for every 50 or 100 items. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "MikeA" wrote in message news:y4Rpi.14820$U47.4704@trnddc08... No - I don't think it is a security issue. I had them try and export the calendar from my application to Outlook and it brings up the Outlook security dialog. I then had them enter 10 minutes so there would be plenty of time to then try and export contacts. It gets to around 110 of 700 contacts to export and then it errors out upon reading the body. I don't get it. It reads the body for the first 100+ contacts and then errors out and gives an "out of memory error." But, it seems to work just fine on my Outlook 2003 but not on their Outlook 2002. Mike |
|
#5
|
|||
|
|||
|
Okay - I have a LOT more information now. Here's what's going on and I do
not understand why but I have discovered that the version of Outlook is not important at all. I had said in my OP that it gets to around reading contact #110 and then errors out. What is happening is the line: ? loItem.Body is the one erroring out. Actually, I'm trying to read the body and it errors out. Now, what is interesting is for the first 110 records it works fine but errors out on record 111. The records are not the ones I'm trying to import from my application but rather other records that were manually entered in Outlook. As it turns out, I had a similar proble on my computer. What happend was I ran it through a loop and when I did this on my computer it worked fine: loItem = loItems.item(1) ? loItem.Body But, when I did this (all from the command prompt in VFP: loItem = loItems.item(60) ? loItem.Body It errors out. In fact, I can't read any properties at all for item 60. But this line: ? loItems.count returns 64. So, I can't understand why for some records (that were directly entered by me in Outlook and not imported from my database application) it errors out but for others it works fine. For now, my solution is to use an ON ERROR command to trap the error and continue. But, I am a little perplexed as to why some objects are not returning any values. Any thoughts? Thanks, Mike "Ken Slovak - [MVP - Outlook]" wrote in message ... Is this running against an Exchange server mailbox? If so it might be the RPC channel limit. That's usually set to 255 and is set in the registry on the server. Once you exceed that number of open RPC channels you get various errors including out of memory errors. If you are looping to handle multiple items then that's likely the problem. The fixes are to eliminate usage of multiple dot operators so Outlook doesn't open internal variables for each dot operator, explicitly releasing your objects each pass through the loop to close their RPC channels and if necessary using a shorter loop called repeatedly. Normally any open internal variables aren't released until you exit the procedure where they were created as they go out of scope. In that case your loop procedure might have to be called repeatedly, say once for every 50 or 100 items. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "MikeA" wrote in message news:y4Rpi.14820$U47.4704@trnddc08... No - I don't think it is a security issue. I had them try and export the calendar from my application to Outlook and it brings up the Outlook security dialog. I then had them enter 10 minutes so there would be plenty of time to then try and export contacts. It gets to around 110 of 700 contacts to export and then it errors out upon reading the body. I don't get it. It reads the body for the first 100+ contacts and then errors out and gives an "out of memory error." But, it seems to work just fine on my Outlook 2003 but not on their Outlook 2002. Mike |
|
#6
|
|||
|
|||
|
I have no idea other than maybe the items aren't of the correct type? If
that's not it then it may be corruption of some sort in the problem items. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "MikeA" wrote in message news:WYdqi.15939$U47.7118@trnddc08... Okay - I have a LOT more information now. Here's what's going on and I do not understand why but I have discovered that the version of Outlook is not important at all. I had said in my OP that it gets to around reading contact #110 and then errors out. What is happening is the line: ? loItem.Body is the one erroring out. Actually, I'm trying to read the body and it errors out. Now, what is interesting is for the first 110 records it works fine but errors out on record 111. The records are not the ones I'm trying to import from my application but rather other records that were manually entered in Outlook. As it turns out, I had a similar proble on my computer. What happend was I ran it through a loop and when I did this on my computer it worked fine: loItem = loItems.item(1) ? loItem.Body But, when I did this (all from the command prompt in VFP: loItem = loItems.item(60) ? loItem.Body It errors out. In fact, I can't read any properties at all for item 60. But this line: ? loItems.count returns 64. So, I can't understand why for some records (that were directly entered by me in Outlook and not imported from my database application) it errors out but for others it works fine. For now, my solution is to use an ON ERROR command to trap the error and continue. But, I am a little perplexed as to why some objects are not returning any values. Any thoughts? Thanks, Mike |
|
#7
|
|||
|
|||
|
If it is corruption (which is what I also suspected) is there some kind of
"pack" or "reindex" or "fix databases" command in Outlook? Thanks, Mike "Ken Slovak - [MVP - Outlook]" wrote in message ... I have no idea other than maybe the items aren't of the correct type? If that's not it then it may be corruption of some sort in the problem items. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "MikeA" wrote in message news:WYdqi.15939$U47.7118@trnddc08... Okay - I have a LOT more information now. Here's what's going on and I do not understand why but I have discovered that the version of Outlook is not important at all. I had said in my OP that it gets to around reading contact #110 and then errors out. What is happening is the line: ? loItem.Body is the one erroring out. Actually, I'm trying to read the body and it errors out. Now, what is interesting is for the first 110 records it works fine but errors out on record 111. The records are not the ones I'm trying to import from my application but rather other records that were manually entered in Outlook. As it turns out, I had a similar proble on my computer. What happend was I ran it through a loop and when I did this on my computer it worked fine: loItem = loItems.item(1) ? loItem.Body But, when I did this (all from the command prompt in VFP: loItem = loItems.item(60) ? loItem.Body It errors out. In fact, I can't read any properties at all for item 60. But this line: ? loItems.count returns 64. So, I can't understand why for some records (that were directly entered by me in Outlook and not imported from my database application) it errors out but for others it works fine. For now, my solution is to use an ON ERROR command to trap the error and continue. But, I am a little perplexed as to why some objects are not returning any values. Any thoughts? Thanks, Mike |
|
#8
|
|||
|
|||
|
Just the external applications ScanPST.exe and ScanOST.exe, both usually
located in the C:\I386 folder. You run those with Outlook closed, using the one for whichever store type you're using. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "MikeA" wrote in message news:uZAqi.1193$8u1.947@trnddc07... If it is corruption (which is what I also suspected) is there some kind of "pack" or "reindex" or "fix databases" command in Outlook? Thanks, Mike |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Outlook 2002 Automation Problem and Contacts | MikeA[_2_] | Outlook - General Queries | 1 | July 25th 07 03:15 AM |
| Problem with Outlook Automation | Neil | Outlook and VBA | 13 | January 15th 07 08:09 AM |
| Outlook-Word automation problem | Gordon Filby | Outlook and VBA | 3 | December 6th 06 01:59 PM |
| Outlook Automation | Tylendal | Outlook and VBA | 3 | April 24th 06 03:39 PM |
| Outlook automation using vbs | Marceepoo | Outlook - Installation | 1 | January 17th 06 05:18 AM |