View Single Post
  #3  
Old May 28th 09, 07:21 AM posted to microsoft.public.outlook.program_addins
Ashish[_3_]
external usenet poster
 
Posts: 10
Default Outlook become non responsive if i write outlook item in bulk

Hi ken,

Thanks for the prompt reply.
To my surprise now, i found out that write works fine.
We were looking for bug in wrong place, as after using MFCMapi tool, i found
out that PR_lastmodification_time is updated.
But while reading it do not read the updated time but the cached time.


I am using the standard code to read LastModification time, suggested by
microsoft in help document.
Following is the code sample.

,,Private mobjOutlook As Microsoft.Office.Interop.Outlook.Application
'outlook application
,,Private mobjOlNs As Microsoft.Office.Interop.Outlook.NameSpace '
current namespace to work with
,,Private mobjApptMAPIFld As
Microsoft.Office.Interop.Outlook.MAPIFolder ' current folder to work
with calendar

,,,, mobjOlNs = mobjOutlook.GetNamespace("MAPI")
,,,, mobjApptMAPIFld = mobjOlNs.GetDefaultFolder(Microsoft.Office.Intero
p.Outlook.OlDefaultFolders.olFolderCalendar)
,,,, mobjApptMAPIFld.Item[i].LastModificationTime// give the appointment


Even if i logoff and logon session through code and use getitembyid property
to retrived the idem detail, it gives me same unmodified date.
Is there any api, though undocumented, which can be used to get the uncached
last modification time ?

Best Regards
Ashish Rawat



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

Just a tip, with those nested IIF's that code will be a real mess to debug.
I'd unwrap it into a set of if blocks to make debugging easier. BTW, that is
Outlook object model code, not Simple MAPI API calls.

Define "many items in bulk" (how many, show the code to create them), define
"behaves inconsistently".

Always mention the Outlook and Window versions, and store type (PST files,
Exchange, etc.).

Do you get any exceptions? Set up try...catch blocks to trap any errors.

Don't use multiple dot operators, especially in loops. Declare your object
variables outside the loop avoid implicitly created objects that cannot be
released. For example:

Dim colItems As Outlook.Items = MyFolder.Items
olitem = colItems.Add(olType)

That way the Items collection can explicitly be released. That's especially
important in loops and hugely so with Exchange, where there's an RPC channel
limit. Exceeding that limit will cause exceptions, and implicitly created
objects all use up RPC channels and can't be released.

--
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" Ashish @discussions.microsoft.com wrote in message
...
Hi
I write outlook item using the simple MAPI api .
Following is the code example.
Dim MyFolder As Microsoft.Office.Interop.Outlook.MAPIFolder
Dim MyFileName As String
Dim OlType As Microsoft.Office.Interop.Outlook.OlItemType
Dim TypeSuffix As String
Dim olitem as object
OlType = GetCorrespondingOlItemType(CalType)
TypeSuffix = GetCorrespondingSuffix(CalType)
MyFolder = IIf(OlType =
Microsoft.Office.Interop.Outlook.OlItemType.olTask Item, mobjTaskMAPIFld,
IIf(OlType =
Microsoft.Office.Interop.Outlook.OlItemType.olAppo intmentItem,
mobjApptMAPIFld, mobjContactMAPIFld))

On Error GoTo OpenAsDefault
Err.Clear()
olitem= MyFolder.Items.Add(OlType)
olitem.save
System.Runtime.InteropServices.Marshal.FinalReleas eComObject(olitem)

if a write many items in bulk, the oulook behaves inconsistently,
Even if i create a new contact manually and update it, lastmodification
time
property will not get updated.

Though this issue is not consistenly reporducible, can some help me
finding
any reason why this is happening ?

Thanks in advance.

Best Regards
Ashish Rawat



Ads