A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Application.ActiveInspector().CurrentItem Returns Wrong(Old) Value



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 27th 09, 08:49 AM posted to microsoft.public.outlook.program_addins
Deepak N
external usenet poster
 
Posts: 4
Default Application.ActiveInspector().CurrentItem Returns Wrong(Old) Value

I have outlook plugin in which OnLoad of Ribbon on contact form(custom form),I access Application.ActiveInspector().CurrentItem as ContactItem.

When I open a contact
*First time Application.ActiveInspector().CurrentItem gives correct value.
*Then I change First Name of this contact in Exchange server through code.
*Then i synchronize Outlook with exchange server and open the form, it displays old value of the contact. If try to edit and save it says contact being edited by other user or program

It is not Sync issue SINCE It displays the new value in the Contact's Business card view!!..
Submitted using http://www.outlookforums.com
Ads
  #2  
Old May 27th 09, 02:23 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Application.ActiveInspector().CurrentItem Returns Wrong(Old) Value

It sounds like you haven't released all object references to that original
object. Make sure you do that. Using managed code you might also have to
call Marshal.ReleaseComObject() on the object as well as GC.Collect().

In addition, make sure you aren't creating implicit object variables that
you cannot release. That happens when you use multiple dot operators such as
this:

explorer.Selection.Count

That creates an implicit Selection object that you can't release. The better
way is to do something like this:

Outlook.Selection selection = explorer.Selection;
int count = selection.Count;

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


"Deepak N" endeep123[at]gmail[dot]com wrote in message
...
I have outlook plugin in which OnLoad of Ribbon on contact form(custom
form),I access Application.ActiveInspector().CurrentItem as ContactItem.

When I open a contact
*First time Application.ActiveInspector().CurrentItem gives correct value.
*Then I change First Name of this contact in Exchange server through code.
*Then i synchronize Outlook with exchange server and open the form, it
displays old value of the contact. If try to edit and save it says contact
being edited by other user or program

It is not Sync issue SINCE It displays the new value in the Contact's
Business card view!!.. Submitted using http://www.outlookforums.com


  #3  
Old June 7th 09, 04:46 PM posted to microsoft.public.outlook.program_addins
Deepak N
external usenet poster
 
Posts: 4
Default Application.ActiveInspector().CurrentItem Returns Wrong(Old) Value

Thanks for reply.
Is it necessary release a COM Object, if a COM object is passed as parameter to a method.

Ex:
PrintName(ContactItemClass contact)
{
Console.WriteLine(contact.FirstName);
//Is it necessary to call Marshal.ReleaseComObject(contact) here
}.
Submitted using http://www.outlookforums.com
  #4  
Old June 8th 09, 01:55 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Application.ActiveInspector().CurrentItem Returns Wrong(Old) Value

That depends on whether or not you intend to use any references to that item
again. If you call Marshal.ReleaseComObject() on it that will release the
item's RCW and unless you re-instantiate another object on that item any
further references to it will return an exception.

At some point the object reference should be released, but when depends on
any further need for it.

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


"Deepak N" endeep123[at]gmail[dot]com wrote in message
...
Thanks for reply.
Is it necessary release a COM Object, if a COM object is passed as
parameter to a method.

Ex: PrintName(ContactItemClass contact)
{
Console.WriteLine(contact.FirstName);
//Is it necessary to call Marshal.ReleaseComObject(contact) here
}. Submitted using http://www.outlookforums.com


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inspector.CurrentItem causes Shared Calendar Issue dotnet_ottawa Add-ins for Outlook 5 April 7th 09 03:34 PM
How to check if ActiveInspector is a new eMail Christian Havel Add-ins for Outlook 2 July 9th 07 08:32 AM
ActiveInspector Recipient's members (Distribution List) not accessible via Word VBA - Redemption [email protected] Add-ins for Outlook 4 November 14th 06 08:28 PM
How to set background image for ActiveInspector.CurrentItem? Burma Jones Outlook - Using Forms 1 February 20th 06 07:13 AM
How to set background image for ActiveInspector.CurrentItem? Burma Jones Outlook and VBA 1 February 20th 06 07:13 AM


All times are GMT +1. The time now is 09:32 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.