msoutlook.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MAPIFolder.get_Folders and Exchange

 
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Programs Add-Ins
Author Message
mwebb



Joined: 14 Aug 2007
Posts: 6

PostPosted: Wed Feb 13, 2008 2:12 pm    Post subject: MAPIFolder.get_Folders and Exchange Reply with quote

Hi all,
My Add-In couldn`t create Folder in Outlook. This error occurs only if
Exchange
caching mode is activated in Outlook and user machine, where the problem
occurs, have large OST file (about 40000 emails).

Using Redemption, VSTO, PIA.

Thanks

Archived from group: microsoft>public>outlook>program_addins
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Wed Feb 13, 2008 7:11 pm    Post subject: Re: MAPIFolder.get_Folders and Exchange Reply with quote

What version of Outlook? Where are you trying to create a folder? How are
you trying to create the folder? Any errors or exceptions? Any other
information that might be helpful?

--
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


"mwebb" wrote in message @microsoft.com...
> Hi all,
> My Add-In couldn`t create Folder in Outlook. This error occurs only if
> Exchange
> caching mode is activated in Outlook and user machine, where the problem
> occurs, have large OST file (about 40000 emails).
>
> Using Redemption, VSTO, PIA.
>
> Thanks
Back to top
View user's profile Send private message
mwebb



Joined: 14 Aug 2007
Posts: 6

PostPosted: Thu Feb 14, 2008 7:14 am    Post subject: Re: MAPIFolder.get_Folders and Exchange Reply with quote

Sorry, I am using Ol2003.

One of the error:
The operation failed.
Microsoft Office Outlook
at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Folders()
Crashed at:
Globals.ThisApplication.GetNameSpace("MAPI").GetDefaultFolder(olFolderContacts).Folders.Add("FolderName")

another one:
Error in IMsgStore.OpenEntry: MAPI_E_CALL_FAILED
Redemption.RDOExchangeMailboxStore
at Redemption.RDOStoreClass.GetFolderFromID(String EntryID, Object Flags)
Crashed at:
rdoFld = rdoSession.Stores.DefaultStore.GetFolderFromID(sEntryID)


"Ken Slovak - [MVP - Outlook]" wrote:

> What version of Outlook? Where are you trying to create a folder? How are
> you trying to create the folder? Any errors or exceptions? Any other
> information that might be helpful?
>
> --
> 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
>
>
> "mwebb" wrote in message
> @microsoft.com...
> > Hi all,
> > My Add-In couldn`t create Folder in Outlook. This error occurs only if
> > Exchange
> > caching mode is activated in Outlook and user machine, where the problem
> > occurs, have large OST file (about 40000 emails).
> >
> > Using Redemption, VSTO, PIA.
> >
> > Thanks
>
>
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Thu Feb 14, 2008 3:09 pm    Post subject: Re: MAPIFolder.get_Folders and Exchange Reply with quote

Using so many concatenated dot operators isn't a good way to go for a few
reasons. For one thing it makes it impossible to find where something is
failing. Also it creates internal object variables, one for each dot
operator, that may or may not be released in a timely manner (especially in
managed code).

You also should be placing any sort of operation like that where you are
getting COM objects through the Interop in Try...Catch blocks so you don't
have unhandled exceptions. In addins all exceptions must be handled or
Outlook may hang or remain in memory or the addin or Outlook may crash.

So to see what's going on change your code to separate everything in an
exception handling block and step the code to validate where the exception
is being thrown. Also, for managed code I've found it best to use all method
arguments, including optional ones. So the code to test on would look
something like this:

Dim oNS As Outlook.NameSpace = Globals.ThisApplication.GetNameSpace("MAPI")
oNS.Logon
Dim oContacts As Outlook.MAPIFolder = oNS.GetDefaultFolder(olFolderContacts)
Dim colFolders As Outlook.Folders = oContacts.Folders
Dim oNewFolder As Outlook.MAPIFolder = colFolders.Add("FolderName",
olFolderContacts)

See where the code is failing then.

Another thing to consider is if this code is being run in a loop of some
sort is that you might be exceeding the RPC channel limit that by default
limits any client to about 250 RPC channel connections to the Exchange
server. Each object you create opens a channel (another way that
concatenated dot operators are a problem) and the channels might not be
released until the procedure ends or you explicitly release the objects (not
only setting them to Nothing but also calling Marshal.ReleaseComObject and
maybe even GC.Collect).

--
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


"mwebb" wrote in message @microsoft.com...
> Sorry, I am using Ol2003.
>
> One of the error:
> The operation failed.
> Microsoft Office Outlook
> at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Folders()
> Crashed at:
> Globals.ThisApplication.GetNameSpace("MAPI").GetDefaultFolder(olFolderContacts).Folders.Add("FolderName")
>
> another one:
> Error in IMsgStore.OpenEntry: MAPI_E_CALL_FAILED
> Redemption.RDOExchangeMailboxStore
> at Redemption.RDOStoreClass.GetFolderFromID(String EntryID, Object
> Flags)
> Crashed at:
> rdoFld = rdoSession.Stores.DefaultStore.GetFolderFromID(sEntryID)
Back to top
View user's profile Send private message
mwebb



Joined: 14 Aug 2007
Posts: 6

PostPosted: Thu Feb 14, 2008 2:08 pm    Post subject: Re: MAPIFolder.get_Folders and Exchange Reply with quote

Hi,

I have this errors when my code tried to create 2 folders and 5000 Contacts
in Exchange on one of the clients machine . The problem is that folders were
created, but i can't access the properties (like Folder.Items.Count) of any
folder, even the for folders that i've created. Also, no Contacts were
created, so i'm not sure that it's because of 250 open RPC channel limit.
And my actual code is not using concatenated dot operators. The provided
early code was just an example.

"Ken Slovak - [MVP - Outlook]" wrote:

> Using so many concatenated dot operators isn't a good way to go for a few
> reasons. For one thing it makes it impossible to find where something is
> failing. Also it creates internal object variables, one for each dot
> operator, that may or may not be released in a timely manner (especially in
> managed code).
>
> You also should be placing any sort of operation like that where you are
> getting COM objects through the Interop in Try...Catch blocks so you don't
> have unhandled exceptions. In addins all exceptions must be handled or
> Outlook may hang or remain in memory or the addin or Outlook may crash.
>
> So to see what's going on change your code to separate everything in an
> exception handling block and step the code to validate where the exception
> is being thrown. Also, for managed code I've found it best to use all method
> arguments, including optional ones. So the code to test on would look
> something like this:
>
> Dim oNS As Outlook.NameSpace = Globals.ThisApplication.GetNameSpace("MAPI")
> oNS.Logon
> Dim oContacts As Outlook.MAPIFolder = oNS.GetDefaultFolder(olFolderContacts)
> Dim colFolders As Outlook.Folders = oContacts.Folders
> Dim oNewFolder As Outlook.MAPIFolder = colFolders.Add("FolderName",
> olFolderContacts)
>
> See where the code is failing then.
>
> Another thing to consider is if this code is being run in a loop of some
> sort is that you might be exceeding the RPC channel limit that by default
> limits any client to about 250 RPC channel connections to the Exchange
> server. Each object you create opens a channel (another way that
> concatenated dot operators are a problem) and the channels might not be
> released until the procedure ends or you explicitly release the objects (not
> only setting them to Nothing but also calling Marshal.ReleaseComObject and
> maybe even GC.Collect).
>
> --
> 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
>
>
> "mwebb" wrote in message
> @microsoft.com...
> > Sorry, I am using Ol2003.
> >
> > One of the error:
> > The operation failed.
> > Microsoft Office Outlook
> > at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Folders()
> > Crashed at:
> > Globals.ThisApplication.GetNameSpace("MAPI").GetDefaultFolder(olFolderContacts).Folders.Add("FolderName")
> >
> > another one:
> > Error in IMsgStore.OpenEntry: MAPI_E_CALL_FAILED
> > Redemption.RDOExchangeMailboxStore
> > at Redemption.RDOStoreClass.GetFolderFromID(String EntryID, Object
> > Flags)
> > Crashed at:
> > rdoFld = rdoSession.Stores.DefaultStore.GetFolderFromID(sEntryID)
>
>
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Thu Feb 14, 2008 8:24 pm    Post subject: Re: MAPIFolder.get_Folders and Exchange Reply with quote

And you say the same code works in non-cached mode but not in cached mode
(or vice versa)? Then I'm stumped based on the code snippets I've seen.

--
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


"mwebb" wrote in message @microsoft.com...
> Hi,
>
> I have this errors when my code tried to create 2 folders and 5000
> Contacts
> in Exchange on one of the clients machine . The problem is that folders
> were
> created, but i can't access the properties (like Folder.Items.Count) of
> any
> folder, even the for folders that i've created. Also, no Contacts were
> created, so i'm not sure that it's because of 250 open RPC channel limit.
> And my actual code is not using concatenated dot operators. The provided
> early code was just an example.
Back to top
View user's profile Send private message
Dmitry Streblechenko



Joined: 12 Aug 2007
Posts: 220

PostPosted: Thu Feb 14, 2008 7:58 pm    Post subject: Re: MAPIFolder.get_Folders and Exchange Reply with quote

You might be running out of the 255 open objects limit impose dby Exchange
in the online mode.
In case of OOM, have you tried to
1. Do not use multiple dot notation to make sure you don't get implicit
variables
2. Explicitly release all COM objects that you are done with as soon as you
are done with them using Marshal.ReleaseCOMOBject. Calling GC.Collect()
every once in a while also won't hurt

In case of Redemption, try the latest (4.5) version - it manages MAPI
objects internally and automatically relases the MAPI objects that can be
reopened when the number of open objects gets too high (see the second item
at http://www.dimastr.com/redemption/history.htm)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"mwebb" wrote in message @microsoft.com...
> Hi,
>
> I have this errors when my code tried to create 2 folders and 5000
> Contacts
> in Exchange on one of the clients machine . The problem is that folders
> were
> created, but i can't access the properties (like Folder.Items.Count) of
> any
> folder, even the for folders that i've created. Also, no Contacts were
> created, so i'm not sure that it's because of 250 open RPC channel limit.
> And my actual code is not using concatenated dot operators. The provided
> early code was just an example.
>
> "Ken Slovak - [MVP - Outlook]" wrote:
>
>> Using so many concatenated dot operators isn't a good way to go for a few
>> reasons. For one thing it makes it impossible to find where something is
>> failing. Also it creates internal object variables, one for each dot
>> operator, that may or may not be released in a timely manner (especially
>> in
>> managed code).
>>
>> You also should be placing any sort of operation like that where you are
>> getting COM objects through the Interop in Try...Catch blocks so you
>> don't
>> have unhandled exceptions. In addins all exceptions must be handled or
>> Outlook may hang or remain in memory or the addin or Outlook may crash.
>>
>> So to see what's going on change your code to separate everything in an
>> exception handling block and step the code to validate where the
>> exception
>> is being thrown. Also, for managed code I've found it best to use all
>> method
>> arguments, including optional ones. So the code to test on would look
>> something like this:
>>
>> Dim oNS As Outlook.NameSpace =
>> Globals.ThisApplication.GetNameSpace("MAPI")
>> oNS.Logon
>> Dim oContacts As Outlook.MAPIFolder =
>> oNS.GetDefaultFolder(olFolderContacts)
>> Dim colFolders As Outlook.Folders = oContacts.Folders
>> Dim oNewFolder As Outlook.MAPIFolder = colFolders.Add("FolderName",
>> olFolderContacts)
>>
>> See where the code is failing then.
>>
>> Another thing to consider is if this code is being run in a loop of some
>> sort is that you might be exceeding the RPC channel limit that by default
>> limits any client to about 250 RPC channel connections to the Exchange
>> server. Each object you create opens a channel (another way that
>> concatenated dot operators are a problem) and the channels might not be
>> released until the procedure ends or you explicitly release the objects
>> (not
>> only setting them to Nothing but also calling Marshal.ReleaseComObject
>> and
>> maybe even GC.Collect).
>>
>> --
>> 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
>>
>>
>> "mwebb" wrote in message
>> @microsoft.com...
>> > Sorry, I am using Ol2003.
>> >
>> > One of the error:
>> > The operation failed.
>> > Microsoft Office Outlook
>> > at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Folders()
>> > Crashed at:
>> > Globals.ThisApplication.GetNameSpace("MAPI").GetDefaultFolder(olFolderContacts).Folders.Add("FolderName")
>> >
>> > another one:
>> > Error in IMsgStore.OpenEntry: MAPI_E_CALL_FAILED
>> > Redemption.RDOExchangeMailboxStore
>> > at Redemption.RDOStoreClass.GetFolderFromID(String EntryID, Object
>> > Flags)
>> > Crashed at:
>> > rdoFld = rdoSession.Stores.DefaultStore.GetFolderFromID(sEntryID)
>>
>>
Back to top
View user's profile Send private message
mwebb



Joined: 14 Aug 2007
Posts: 6

PostPosted: Fri Feb 15, 2008 8:55 am    Post subject: Re: MAPIFolder.get_Folders and Exchange Reply with quote

Hi, all.
Thanks, i will try v. 4.5 of Redemption

"Dmitry Streblechenko" wrote:

> You might be running out of the 255 open objects limit impose dby Exchange
> in the online mode.
> In case of OOM, have you tried to
> 1. Do not use multiple dot notation to make sure you don't get implicit
> variables
> 2. Explicitly release all COM objects that you are done with as soon as you
> are done with them using Marshal.ReleaseCOMOBject. Calling GC.Collect()
> every once in a while also won't hurt
>
> In case of Redemption, try the latest (4.5) version - it manages MAPI
> objects internally and automatically relases the MAPI objects that can be
> reopened when the number of open objects gets too high (see the second item
> at http://www.dimastr.com/redemption/history.htm)
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "mwebb" wrote in message
> @microsoft.com...
> > Hi,
> >
> > I have this errors when my code tried to create 2 folders and 5000
> > Contacts
> > in Exchange on one of the clients machine . The problem is that folders
> > were
> > created, but i can't access the properties (like Folder.Items.Count) of
> > any
> > folder, even the for folders that i've created. Also, no Contacts were
> > created, so i'm not sure that it's because of 250 open RPC channel limit.
> > And my actual code is not using concatenated dot operators. The provided
> > early code was just an example.
> >
> > "Ken Slovak - [MVP - Outlook]" wrote:
> >
> >> Using so many concatenated dot operators isn't a good way to go for a few
> >> reasons. For one thing it makes it impossible to find where something is
> >> failing. Also it creates internal object variables, one for each dot
> >> operator, that may or may not be released in a timely manner (especially
> >> in
> >> managed code).
> >>
> >> You also should be placing any sort of operation like that where you are
> >> getting COM objects through the Interop in Try...Catch blocks so you
> >> don't
> >> have unhandled exceptions. In addins all exceptions must be handled or
> >> Outlook may hang or remain in memory or the addin or Outlook may crash.
> >>
> >> So to see what's going on change your code to separate everything in an
> >> exception handling block and step the code to validate where the
> >> exception
> >> is being thrown. Also, for managed code I've found it best to use all
> >> method
> >> arguments, including optional ones. So the code to test on would look
> >> something like this:
> >>
> >> Dim oNS As Outlook.NameSpace =
> >> Globals.ThisApplication.GetNameSpace("MAPI")
> >> oNS.Logon
> >> Dim oContacts As Outlook.MAPIFolder =
> >> oNS.GetDefaultFolder(olFolderContacts)
> >> Dim colFolders As Outlook.Folders = oContacts.Folders
> >> Dim oNewFolder As Outlook.MAPIFolder = colFolders.Add("FolderName",
> >> olFolderContacts)
> >>
> >> See where the code is failing then.
> >>
> >> Another thing to consider is if this code is being run in a loop of some
> >> sort is that you might be exceeding the RPC channel limit that by default
> >> limits any client to about 250 RPC channel connections to the Exchange
> >> server. Each object you create opens a channel (another way that
> >> concatenated dot operators are a problem) and the channels might not be
> >> released until the procedure ends or you explicitly release the objects
> >> (not
> >> only setting them to Nothing but also calling Marshal.ReleaseComObject
> >> and
> >> maybe even GC.Collect).
> >>
> >> --
> >> 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
> >>
> >>
> >> "mwebb" wrote in message
> >> @microsoft.com...
> >> > Sorry, I am using Ol2003.
> >> >
> >> > One of the error:
> >> > The operation failed.
> >> > Microsoft Office Outlook
> >> > at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Folders()
> >> > Crashed at:
> >> > Globals.ThisApplication.GetNameSpace("MAPI").GetDefaultFolder(olFolderContacts).Folders.Add("FolderName")
> >> >
> >> > another one:
> >> > Error in IMsgStore.OpenEntry: MAPI_E_CALL_FAILED
> >> > Redemption.RDOExchangeMailboxStore
> >> > at Redemption.RDOStoreClass.GetFolderFromID(String EntryID, Object
> >> > Flags)
> >> > Crashed at:
> >> > rdoFld = rdoSession.Stores.DefaultStore.GetFolderFromID(sEntryID)
> >>
> >>
>
>
>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Microsoft Exchange Client Extension v/s COM Add-in Hi, I am new to this field so Please help me out how to start.. I have read Microsoft Exchange client extension and Com add-in both. But I am unable to find out the difference between these two i.e which one should be used in which situations? I have to d

Redemption and Exchange Server issues Hi ALL, I have AddIn devoloped on C# 2.0 VSTO 2005. Also i use Redemption ver 4.4. The problem i encountered is when my AddIn run in Outlook 12 and Exchange Server 2003 installed on same machine the Redemption seems to be not working, the Rdemption failed

Exchange folder and cached folder in OST file not in sync We have written a server application that periodically accesses certain folders in Exchange user's mailboxes (for which the server has permission) and moves the messages to the Deleted Items folder. The application is a service running on Windows XP or S

Exchange 5.5 and MAC OS Hello, our graphic artist just received a new PowerMac. He would like to send and receive email from his new MAC through our exchange 5.5 server. How should this be configured? Does it have something to do with IMAP? All information is greatly appreciated

Do I need Exchange I am using Outlook 2007 Professional and want to create a new task form. Do I need exchange to do this? If not how do I create a form? Thanks.
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Programs Add-Ins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group