When drag a mail item and drop to some other folder item_add event is called b'se an item is added to a folder. But before item_add What's actual event for drag and drop in outlook? Item_add event is called for all cases like saving a mail, sending a mail, moving a mail. But if i want to call item_add event for special case(drag and drop) then what i need to do.
There are no drag and drop events in the Outlook object model, as a look at the Object Browser will tell you. You'd have to go down to the Windows message hook level and hook all such messages using Win32 API calls and a message hook. -- 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 "Ashish" wrote in message news:ObheBZX%23JHA.1252@TK2MSFTNGP04.phx.gbl... > When drag a mail item and drop to some other folder item_add event is > called b'se an item is added to a folder. > > But before item_add What's actual event for drag and drop in outlook? > Item_add event is called for all cases like saving a mail, sending a mail, > moving a mail. > But if i want to call item_add event for special case(drag and drop) then > what i need to do. >
Ok i think item_add event is enough to handle the case. But here there is a problem. When a new mail arrives application_newmail event(event number 0xfba7 in c++) is called.And when move a mail from one folder to another folder then also application_newmail event is called. I'm facing the problem if a exchange user has some mails in its inbox and i create profile for this user and login to user using outlook. Here application_newmail event will call until it receives all mails in inbox(outlook looks like hang until all mail receive). Is there any way to recognize this case? Means can i set a bool which tells me that outlook has received all mails and ready for any action now? When launch outlook OnStartupComplete is called and return before outlook receive new mails. Is there any other function which tells outlook is idle now. Or can we differentiate in application_newmail event for the cases when new mail arrive or move a mail from one folder to another. Supp"Ken Slovak - [MVP - Outlook]" wrote in message news:%23v5rKJY%23JHA.5040@TK2MSFTNGP04.phx.gbl... > There are no drag and drop events in the Outlook object model, as a look > at the Object Browser will tell you. You'd have to go down to the Windows > message hook level and hook all such messages using Win32 API calls and a > message hook. > > -- > 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 > > > "Ashish" wrote in message > news:ObheBZX%23JHA.1252@TK2MSFTNGP04.phx.gbl... >> When drag a mail item and drop to some other folder item_add event is >> called b'se an item is added to a folder. >> >> But before item_add What's actual event for drag and drop in outlook? >> Item_add event is called for all cases like saving a mail, sending a >> mail, moving a mail. >> But if i want to call item_add event for special case(drag and drop) then >> what i need to do. >> >
If you are getting NewMail() in cases other than when email is delivered to the Inbox of the primary mailbox then something is very wrong. That event only fires in that case, and only then at intervals, allowing you to miss incoming items. A better event to use would be either Inbox.Items.ItemAdd() or NewMailEx(). NewMailEx() gives you a delimited list of the EntryID's of items that have come in since the last time that event fired. ItemAdd() has a limitation common to most MAPI events where it won't fire at all if more than 16 items come in at once. -- 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 "Ashish" wrote in message news:OTgECH9%23JHA.3544@TK2MSFTNGP04.phx.gbl... > Ok i think item_add event is enough to handle the case. But here there is > a problem. > > When a new mail arrives application_newmail event(event number 0xfba7 in > c++) is called.And when move a mail from one folder to another folder then > also application_newmail event is called. > I'm facing the problem if a exchange user has some mails in its inbox and > i create profile for this user and login to user using outlook. Here > application_newmail event will call until it receives all mails in > inbox(outlook looks like hang until all mail receive). Is there any way to > recognize this case? Means can i set a bool which tells me that outlook > has received all mails and ready for any action now? When launch outlook > OnStartupComplete is called and return before outlook receive new mails. > Is there any other function which tells outlook is idle now. > > Or can we differentiate in application_newmail event for the cases when > new mail arrive or move a mail from one folder to another.
There are 2 newmail events in application. I dont know exact functions in VB. I'm using c++. newmail(0xf003) this is call when we create a new mail in outlook newmailex(0xfba7) this is call when a new mail receives in outlook for following cases 1. new mail receive in inbox folder 2. we create a new mail and save/send it 3. we move a mail from one folder to another folder For all cases outlook first calls application_newmailex then Items.ItemAdd > NewMailEx() gives you a delimited list of the EntryID's of items that have > come in since the last time that event fired. Please explain how EntryID's can help? The critical case is if a exchange user has some mails already in it and we create a new profile for this user in outlook and login to outlook then application_newmailex and Items.ItemAdd will be call for all mails which come to inbox until outlook restored all old mails. "Ken Slovak - [MVP - Outlook]" wrote in message news:uKSGY79%23JHA.4560@TK2MSFTNGP05.phx.gbl... > If you are getting NewMail() in cases other than when email is delivered > to the Inbox of the primary mailbox then something is very wrong. > > That event only fires in that case, and only then at intervals, allowing > you to miss incoming items. > > A better event to use would be either Inbox.Items.ItemAdd() or > NewMailEx(). NewMailEx() gives you a delimited list of the EntryID's of > items that have come in since the last time that event fired. > > ItemAdd() has a limitation common to most MAPI events where it won't fire > at all if more than 16 items come in at once. > > -- > 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 > > > "Ashish" wrote in message > news:OTgECH9%23JHA.3544@TK2MSFTNGP04.phx.gbl... >> Ok i think item_add event is enough to handle the case. But here there is >> a problem. >> >> When a new mail arrives application_newmail event(event number 0xfba7 in >> c++) is called.And when move a mail from one folder to another folder >> then also application_newmail event is called. >> I'm facing the problem if a exchange user has some mails in its inbox and >> i create profile for this user and login to user using outlook. Here >> application_newmail event will call until it receives all mails in >> inbox(outlook looks like hang until all mail receive). Is there any way >> to recognize this case? Means can i set a bool which tells me that >> outlook has received all mails and ready for any action now? When launch >> outlook OnStartupComplete is called and return before outlook receive new >> mails. Is there any other function which tells outlook is idle now. >> >> Or can we differentiate in application_newmail event for the cases when >> new mail arrive or move a mail from one folder to another. >
You've lost me completely. There are both NewMail() and NewMailEx() (for VB, VBA, VB.NET and C#). I don't do C++ but my guess is that the event with the higher index is NewMailEx(). However, both events should only fire when new mail is delivered to the default Inbox in that Outlook profile. If you are seeing anything else then you're seeing something that I've never heard of in the Outlook object model and I have no idea what's going on. Just look at the object model in the Object Browser in the Outlook VBA project to see what I'm talking about. NewMailEx() should only fire in case 1, never in your cases 2 & 3. The list of EntryID's you get from NewMailEx() lets you access each new mail that came in, which is what I thought we were talking about. -- 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 "Ashish" wrote in message news:ufAnNM%23%23JHA.4900@TK2MSFTNGP02.phx.gbl... > There are 2 newmail events in application. I dont know exact functions in > VB. I'm using c++. > > newmail(0xf003) this is call when we create a new mail in outlook > newmailex(0xfba7) this is call when a new mail receives in outlook for > following cases > 1. new mail receive in inbox folder > 2. we create a new mail and save/send it > 3. we move a mail from one folder to another folder > > For all cases outlook first calls application_newmailex then Items.ItemAdd > >> NewMailEx() gives you a delimited list of the EntryID's of items that >> have come in since the last time that event fired. > > Please explain how EntryID's can help? > > The critical case is if a exchange user has some mails already in it and > we create a new profile for this user in outlook and login to outlook then > application_newmailex and Items.ItemAdd will be call for all mails which > come to inbox until outlook restored all old mails.
You are correct it's NewMailEx(0xfba7) which is call when a new mail receive in Inbox folder. Lets forget about NewMail(0xf003) it's not related here and it's only call when we click on File->New Mail item in outlook. NewMailEx is called when user receives new mails in its inbox folder. Or if user already contains some mails and we create its profile in outlook. When we login to user NewMailEx is call which receive all existing mails(which are on server) in outlook. But in my outlook(user profile is created using exchange server) NewMailEx is also called when after creating a new mail we save it, or we move an existing mail from one folder to another. So i still dont know by which action item_add event is called. I think the only way(as per myknowledge) is to implement drag and drop. You have already said it should do using windows API. I think i should implement drag and drop in active inspector. I dont know how to do it. Is there any link available on net? "Ken Slovak - [MVP - Outlook]" wrote in message news:u34LkV$%23JHA.1488@TK2MSFTNGP03.phx.gbl... > You've lost me completely. > > There are both NewMail() and NewMailEx() (for VB, VBA, VB.NET and C#). I > don't do C++ but my guess is that the event with the higher index is > NewMailEx(). However, both events should only fire when new mail is > delivered to the default Inbox in that Outlook profile. > > If you are seeing anything else then you're seeing something that I've > never heard of in the Outlook object model and I have no idea what's going > on. Just look at the object model in the Object Browser in the Outlook VBA > project to see what I'm talking about. > > NewMailEx() should only fire in case 1, never in your cases 2 & 3. > > The list of EntryID's you get from NewMailEx() lets you access each new > mail that came in, which is what I thought we were talking about. > > -- > 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 > > > "Ashish" wrote in message > news:ufAnNM%23%23JHA.4900@TK2MSFTNGP02.phx.gbl... >> There are 2 newmail events in application. I dont know exact functions in >> VB. I'm using c++. >> >> newmail(0xf003) this is call when we create a new mail in outlook >> newmailex(0xfba7) this is call when a new mail receives in outlook for >> following cases >> 1. new mail receive in inbox folder >> 2. we create a new mail and save/send it >> 3. we move a mail from one folder to another folder >> >> For all cases outlook first calls application_newmailex then >> Items.ItemAdd >> >>> NewMailEx() gives you a delimited list of the EntryID's of items that >>> have come in since the last time that event fired. >> >> Please explain how EntryID's can help? >> >> The critical case is if a exchange user has some mails already in it and >> we create a new profile for this user in outlook and login to outlook >> then application_newmailex and Items.ItemAdd will be call for all mails >> which come to inbox until outlook restored all old mails. >
You'd have to research that yourself, I'm not familiar with any such examples. I can see NewMailEx() firing when items are downloaded from the Exchange server on startup only if the profile is cached. If online the items are already there in Inbox. I still have no idea why you'd see that event in the other circumstances you mention. -- 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 "Ashish" wrote in message news:eBrTe4h$JHA.1488@TK2MSFTNGP03.phx.gbl... > You are correct it's NewMailEx(0xfba7) which is call when a new mail > receive in Inbox folder. Lets forget about NewMail(0xf003) it's not > related here and it's only call when we click on File->New Mail item in > outlook. > NewMailEx is called when user receives new mails in its inbox folder. Or > if user already contains some mails and we create its profile in outlook. > When we login to user NewMailEx is call which receive all existing > mails(which are on server) in outlook. > > But in my outlook(user profile is created using exchange server) NewMailEx > is also called when after creating a new mail we save it, or we move an > existing mail from one folder to another. > So i still dont know by which action item_add event is called. > I think the only way(as per myknowledge) is to implement drag and drop. > You have already said it should do using windows API. I think i should > implement drag and drop in active inspector. I dont know how to do it. Is > there any link available on net?