none
item.userproperties.count for apointment recieved RRS feed

  • Question

  • Hi,

    I am working on outlook addin developed on vsto 2005 for outlook 2007.

    its running on two machines having same setting for outlook 2007 and having outlook version as outlook 2007 (12.0.6562.5003)sp2 mso(12.0.6562.5003)

    In addin i captured itemadd event and checking item.userproperties.count. when appointment added in calendar on acceptance of an invitation sent by another user, itemadd event is getting item.userproperties.count = 0

    is it right behavior?

    Please note, these appointment items will have custom properties set, when item was created orginally

     

    if yes, then i am having two other machine running same addin. But, its running for outlook 2007 (12.0.6607.1000) sp3 mso(12.0.6607.1000)under xp operating system.

    Here for same above scenario, item.userproperties.count is coming out greater than zero. i am not sure, which behavior is right

    please let me know , which is right behavior?

     

    Thanks


    • Edited by Nitrup Sunday, January 29, 2012 10:03 PM sentence correction
    Sunday, January 29, 2012 9:59 PM

Answers

  • UseTnef is a MAPI property, you cannot set it by UserProperties, only by using PropertyAccessor on MailItem. But from your last message i get impression that you do not want to transfer user properties (which UseTnef could achieve) but rather to be sure to _not_ transfer any user properties, am i correct? if so, then your second code snippet is enough for this, however there is question - why do you want to achieve this? remember that your code may not be the only one running on those outlooks and by butchering those user properties you may break other macros or add-ins.

    • Marked as answer by Nitrup Wednesday, February 1, 2012 11:37 AM
    Wednesday, February 1, 2012 9:30 AM

All replies

  • Are you sending to another Exchange mailbox? Or through SMTP?

    If you look at the item in the Sent Items folder with OutlookSpy (http://www.dimastr.com/outspy, click the Item button), do you see the user properties?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Sunday, January 29, 2012 10:47 PM
  • hi,

    Thanks for reply

    i am not sure about sending to another exchange or throgh SMTP, but how can i check it?

    but will this make any difference?

    i will not be able to install outlook spy on the machine where outllok 2007 sp3 is running, because i do not have any control over those machine and here its making a difference. is there any other way to knaow why there is a difference?

    Thanks

     

     

    Monday, January 30, 2012 9:32 AM
  • It makes big difference if comunication is made through exchange or other means - normally, under the same exchange (same organization) user properties set by one outlook should be sent and visible on recieving end. Outlook does this by sending special 'winmail.dat' attachment that stores all additional data (for example user properties). If however mail is sent by external mail server (not exchange) then this attachment may be stripped on not even sent in first place.
    Monday, January 30, 2012 12:34 PM
  • Hi,

    in our organisation we are running outllok 2007 sp2 version and having same exchange, now when we are running addins on our enviorenment, it always gives uerproperties count to zero.

    as you said i installed outlook spy and checked throgh that as well and checked item.userproperties.count is coming out zero

    howvere if we run same addin on our client side, they are running sp3(i am not sure about their exchange settings), it always comes up with count greatr than zero.

    is there any way i can check in regarding exchange settings for outlook on the machines?

    Thanks

    Monday, January 30, 2012 1:28 PM
  • What is the UseTnef property set on the outgoing meeting requests (click IMessage button in OutlookSpy)?
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Monday, January 30, 2012 1:44 PM
  • Hi Dmitry,

    i can not find this proerty on outlookspy.

    taht how i am looking at that item

    1) gone to sent item

    2) open item that has recently benn sent for an invitation

    3) click an IMessage button

    but can not find this property, howvere i can find my custom properties in the property list, but not UseTnef

     

     

    Monday, January 30, 2012 2:41 PM
  • Hi dimtry,

    i can reproduce this on my machine as well, i found that if in account settings, i have two e-mail accounts , one is set to use POP/SMTP and another is set to use Exchange.

    if i select to send using POP/SMTP, it says userproperties count to zero, but if select Exchange ,then ,userproperties count is greater than zero.

    if i send it throgh exchange, now i can see UseTnef property in outlook spy on the machine where invitation is recieved, its showing value as false

    Now, is there anyway to make sure userproperties should not send  even i am sending through exchange? and what to do with UseTnef property now

    Thnaks

    Tuesday, January 31, 2012 1:20 PM
  • Have yo utried to set the UseTnef property explicilty?
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Tuesday, January 31, 2012 1:30 PM
  • not yet.

    but should i do that? if yes then should i set it on appointment item and to what value?

     

    Thanks

    Tuesday, January 31, 2012 1:35 PM
  • The original appointment is never sent - Outlook creates a brand new meeting request/update and sends it instead. You can try to set it on the original appoitment and hope that Outlook copies the property, or you can try to use the Application.ItemSend event.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Tuesday, January 31, 2012 1:38 PM
  • Hi Dimtry,

    i used following

    Public Sub itemsend(ByVal Item As Object, ByRef cancel As Boolean) Handles app.ItemSend      
            Dim UserProperties As Outlook.UserProperties
            UserProperties = Item.UserProperties
            Dim Tnef As Outlook.UserProperty = Nothing
            If Tnef Is Nothing Then Tnef = UserProperties.Add("UseTnef", OlUserPropertyType.olYesNo, False)
            'Things that can be changed without opening the booking
            Tnef.Value = True
            NAR(Tnef)
            NAR(UserProperties)
        End Sub

    now whether i set Tnef.Value to true or false, everytime it gives me propertiescount greater than zero

    so i tried with following in itemsend .

    While Item.UserProperties.count > 0
                Item.UserProperties.remove(1)
                Item.save()
            End While

    it worked, but  i am not sure is there any consequences of using this?

    will it create any issue with original appointment item?

    if i am not wrong then item handled in ItemSend event is not original item.

    please guide me here, so that i can move forward in implementing this.

    Thanks

     

    Tuesday, January 31, 2012 4:21 PM
  • UseTnef is a MAPI property, you cannot set it by UserProperties, only by using PropertyAccessor on MailItem. But from your last message i get impression that you do not want to transfer user properties (which UseTnef could achieve) but rather to be sure to _not_ transfer any user properties, am i correct? if so, then your second code snippet is enough for this, however there is question - why do you want to achieve this? remember that your code may not be the only one running on those outlooks and by butchering those user properties you may break other macros or add-ins.

    • Marked as answer by Nitrup Wednesday, February 1, 2012 11:37 AM
    Wednesday, February 1, 2012 9:30 AM
  • Yes, i do not want to transfer usreproperties.

    I want to achieve because i need to diffrentiate betweeen a copying item to a delgate calendar having attendess  and item rceieved as an invitation.

    See what was happening.

    if you copy a item to a delgate calendar having attendees , outlook is changing the MeetingStatus of that appointment to olMeetingReceived, which is also true for the items rceievd as an invitation.

    Now, because my account was set to send mail throgh SMTP/POP, when we send an invitation , UserProperties count for those items was coming out to be zero at recieving end and when we copy to delegate calendar , it's greater thatn zero. which was good enough to differentiate.

    So, either you copy or you recieve an invitation, itemadd event fires. which i am capturing to check vraious case whem item added in your calendar or delgate calendar. In order to diffrentiate between copying item to a delgate calendar having attendess  and item rceieved as an invitation i am doing this.

    But as you said in your previous reply ,UserProperties count depends on whether you are sending through exchange or throgh SMTP, so i am removing those properties, so that on recieving end UserProperties count become zero

    But those userproperties only belong to my addin, it do not belong to any other addin. so i do not think it will messed up with other addin. However you have more knowlede than me on these issues. so let me know if i can achieve above thing in any differnt way, so that ineed not to remove UserProperties.

    Thanks

    Wednesday, February 1, 2012 10:47 AM
  • ok, stay with your code, but only check for your own user properties (add and remove only them).

    Wednesday, February 1, 2012 10:57 AM
  • ok, i wil check with that, thanks a lot for your help!
    Wednesday, February 1, 2012 11:36 AM