![]() |
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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi,
Does folder has last modification date property like contact/task item? Thanks |
Ads |
#2
|
|||
|
|||
![]()
Folders don't expose that property to the Outlook object model before
Outlook 2007. However, if you are using Outlook 2007 you can use the PropertyAccessor with the DASL tag "DAV:getlastmodified" to get that information. You can also use CDO 1.21 or Extended MAPI or a MAPI wrapper such as Redemption (www.dimastr.com/redemption) to get that information using the MAPI property tag PR_LAST_MODIFICATION_TIME (0x30080040). -- 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 "ck" wrote in message ... Hi, Does folder has last modification date property like contact/task item? Thanks |
#3
|
|||
|
|||
![]()
Hi Ken,
Thanks for the reply. I have checked the redemption website. The examples showed is actually about the item in folder. For example: Dim utils, oItem, PrDate , Date Set utils = CreateObject("Redemption.MAPIUtils") Set oItem = Outlook.session.GetDefaultFolder(olFolderContacts) .Items(1) 'This is the line that point to contact item in contact folder PrDate = &H30080040 Date= utils.HrGetOneProp(oItem.MAPIOBJECT, PrDate ) MsgBox Date How about the folder last modification using Redemption.MAPIUtils? I am getting it right? "Ken Slovak - [MVP - Outlook]" wrote: Folders don't expose that property to the Outlook object model before Outlook 2007. However, if you are using Outlook 2007 you can use the PropertyAccessor with the DASL tag "DAV:getlastmodified" to get that information. You can also use CDO 1.21 or Extended MAPI or a MAPI wrapper such as Redemption (www.dimastr.com/redemption) to get that information using the MAPI property tag PR_LAST_MODIFICATION_TIME (0x30080040). -- 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 "ck" wrote in message ... Hi, Does folder has last modification date property like contact/task item? Thanks |
#4
|
|||
|
|||
![]()
I'd probably use RDOSession myself:
Dim oSession As Redemption.RDOSession Dim oFolder As Redemption.RDOFolder Dim lastMod As Date Set oSession = CreateObject(Redemption.RDOSession") ' use Application only in Outlook VBA, otherwise get Application object, then get NameSpace. oSession.MAPIOBJECT = Application.Session.MAPIOBJECT Set oFolder = oSession.GetDefaultFolder(olFolderContacts) lastMod = oFolder.Fields(&H30080040) Note that lastMod will be in UTC and not in local time. Use MAPIUtils to do the conversion using the HrGMTToLocal() method. -- 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 "ck" wrote in message news ![]() Hi Ken, Thanks for the reply. I have checked the redemption website. The examples showed is actually about the item in folder. For example: Dim utils, oItem, PrDate , Date Set utils = CreateObject("Redemption.MAPIUtils") Set oItem = Outlook.session.GetDefaultFolder(olFolderContacts) .Items(1) 'This is the line that point to contact item in contact folder PrDate = &H30080040 Date= utils.HrGetOneProp(oItem.MAPIOBJECT, PrDate ) MsgBox Date How about the folder last modification using Redemption.MAPIUtils? I am getting it right? |
#5
|
|||
|
|||
![]()
Hi Ken,
I tried RDOSession but the oFolder.Fields(&H30080040) value is = Empty. Then i tried to change the name of the contact default folder to make sure the folder is really changed. Try again but oFolder.Fields(&H30080040) still empty. By the way, you commented that: "use Application only in Outlook VBA, otherwise get Application object, then get NameSpace." Why Application only in Outlook VBA? I tried Application in VB6 Com Add-In and it seems to work fine. Thanks. "Ken Slovak - [MVP - Outlook]" wrote: I'd probably use RDOSession myself: Dim oSession As Redemption.RDOSession Dim oFolder As Redemption.RDOFolder Dim lastMod As Date Set oSession = CreateObject("Redemption.RDOSession") ' use Application only in Outlook VBA, otherwise get Application object, then get NameSpace. oSession.MAPIOBJECT = Application.Session.MAPIOBJECT Set oFolder = oSession.GetDefaultFolder(olFolderContacts) lastMod = oFolder.Fields(&H30080040) Note that lastMod will be in UTC and not in local time. Use MAPIUtils to do the conversion using the HrGMTToLocal() method. -- 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 "ck" wrote in message news ![]() Hi Ken, Thanks for the reply. I have checked the redemption website. The examples showed is actually about the item in folder. For example: Dim utils, oItem, PrDate , Date Set utils = CreateObject("Redemption.MAPIUtils") Set oItem = Outlook.session.GetDefaultFolder(olFolderContacts) .Items(1) 'This is the line that point to contact item in contact folder PrDate = &H30080040 Date= utils.HrGetOneProp(oItem.MAPIOBJECT, PrDate ) MsgBox Date How about the folder last modification using Redemption.MAPIUtils? I am getting it right? |
#6
|
|||
|
|||
![]()
The code works here. I used this test Sub in the Outlook VBA:
Sub TestFolderModificationDate() Dim oSession As Redemption.rdoSession Dim oFolder As Redemption.rdoFolder Dim oUtils As Redemption.MAPIUtils Dim lastMod As Date Set oSession = CreateObject("Redemption.RDOSession") ' use Application only in Outlook VBA, otherwise get Application object, then get NameSpace. oSession.MAPIOBJECT = Application.Session.MAPIOBJECT Set oUtils = CreateObject("Redemption.MAPIUtils") oUtils.MAPIOBJECT = oSession.MAPIOBJECT Set oFolder = oSession.GetDefaultFolder(olFolderContacts) lastMod = oFolder.Fields(&H30080040) Debug.Print "UTC time: " & CStr(lastMod) lastMod = oUtils.HrGMTToLocal(lastMod) Debug.Print "local time: " & CStr(lastMod) End Sub The output values matched with what I see in OutlookSpy. Of course that test doesn't have error handling and it doesn't release objects, etc. but it works. Application is the Outlook.Application object intrinsically in Outlook VBA. In Word VBA Application is Word.Application, etc. In a VB6 COM addin you get Application passed to you in OnConnection() and that's also a local (to that event handler) Outlook.Application object. Of course you'd declare a variable to make that available in the rest of your code. -- 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 "ck" wrote in message ... Hi Ken, I tried RDOSession but the oFolder.Fields(&H30080040) value is = Empty. Then i tried to change the name of the contact default folder to make sure the folder is really changed. Try again but oFolder.Fields(&H30080040) still empty. By the way, you commented that: "use Application only in Outlook VBA, otherwise get Application object, then get NameSpace." Why Application only in Outlook VBA? I tried Application in VB6 Com Add-In and it seems to work fine. Thanks. |
#7
|
|||
|
|||
![]()
Ken,
Thank you for the explanation and code snippet. I have Change - oSession.MAPIOBJECT = Application.Session.MAPIOBJECT To - oAppl.GetNamespace("MAPI").MAPIOBJECT The oFolder.Fields(&H30080040) still = Empty. Probably something is wrong with my Outlook. Just to confirm with you, i used OutlookSpy (IMAPIFolder) to check default contact folder. The GetProps tab doesn't have any PR_LAST_MODIFICATION_TIME property. How do you check the value? Thanks. My code: Dim oAppl As Outlook.Application Dim oSession As Redemption.RDOSession Dim oFolder As Redemption.RDOFolder Dim oUtils As Redemption.MAPIUtils Dim lastMod As Date ' Set oAppl = CreateObject("Outlook.Application") Set oSession = CreateObject("Redemption.RDOSession") 'oSession.MAPIOBJECT = Application.Session.MAPIOBJECT oSession.MAPIOBJECT = oAppl.GetNamespace("MAPI").MAPIOBJECT Set oUtils = CreateObject("Redemption.MAPIUtils") oUtils.MAPIOBJECT = oSession.MAPIOBJECT ' Set oFolder = oSession.GetDefaultFolder(olFolderContacts) lastMod = oFolder.fields(&H30080040) Debug.Print "UTC time: " & CStr(lastMod) lastMod = oUtils.HrGMTToLocal(lastMod) Debug.Print "local time: " & CStr(lastMod) "Ken Slovak - [MVP - Outlook]" wrote: The code works here. I used this test Sub in the Outlook VBA: Sub TestFolderModificationDate() Dim oSession As Redemption.rdoSession Dim oFolder As Redemption.rdoFolder Dim oUtils As Redemption.MAPIUtils Dim lastMod As Date Set oSession = CreateObject("Redemption.RDOSession") ' use Application only in Outlook VBA, otherwise get Application object, then get NameSpace. oSession.MAPIOBJECT = Application.Session.MAPIOBJECT Set oUtils = CreateObject("Redemption.MAPIUtils") oUtils.MAPIOBJECT = oSession.MAPIOBJECT Set oFolder = oSession.GetDefaultFolder(olFolderContacts) lastMod = oFolder.Fields(&H30080040) Debug.Print "UTC time: " & CStr(lastMod) lastMod = oUtils.HrGMTToLocal(lastMod) Debug.Print "local time: " & CStr(lastMod) End Sub The output values matched with what I see in OutlookSpy. Of course that test doesn't have error handling and it doesn't release objects, etc. but it works. Application is the Outlook.Application object intrinsically in Outlook VBA. In Word VBA Application is Word.Application, etc. In a VB6 COM addin you get Application passed to you in OnConnection() and that's also a local (to that event handler) Outlook.Application object. Of course you'd declare a variable to make that available in the rest of your code. -- 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 "ck" wrote in message ... Hi Ken, I tried RDOSession but the oFolder.Fields(&H30080040) value is = Empty. Then i tried to change the name of the contact default folder to make sure the folder is really changed. Try again but oFolder.Fields(&H30080040) still empty. By the way, you commented that: "use Application only in Outlook VBA, otherwise get Application object, then get NameSpace." Why Application only in Outlook VBA? I tried Application in VB6 Com Add-In and it seems to work fine. Thanks. |
#8
|
|||
|
|||
![]()
Well, something's wrong. I'm not sure what. Using OutlookSpy and clicking on
IMAPIFolder and scrolling down to PR_LAST_MODIFICATION_TIME (listed alphabetically among the named properties) I see a value there in GetProps in the default Contacts folder. I also see that property in every other folder in my mailbox, default or non-default. Where is your code running? What application is hosting that VBA? If it's Outlook VBA do not use CreateObject("Outlook.Application"), use the intrinsic Application object provided by the Outlook VBA. Use CreateObject only if running in some other VBA environment, such as Word or Excel VBA. -- 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 "ck" wrote in message ... Ken, Thank you for the explanation and code snippet. I have Change - oSession.MAPIOBJECT = Application.Session.MAPIOBJECT To - oAppl.GetNamespace("MAPI").MAPIOBJECT The oFolder.Fields(&H30080040) still = Empty. Probably something is wrong with my Outlook. Just to confirm with you, i used OutlookSpy (IMAPIFolder) to check default contact folder. The GetProps tab doesn't have any PR_LAST_MODIFICATION_TIME property. How do you check the value? Thanks. My code: Dim oAppl As Outlook.Application Dim oSession As Redemption.RDOSession Dim oFolder As Redemption.RDOFolder Dim oUtils As Redemption.MAPIUtils Dim lastMod As Date ' Set oAppl = CreateObject("Outlook.Application") Set oSession = CreateObject("Redemption.RDOSession") 'oSession.MAPIOBJECT = Application.Session.MAPIOBJECT oSession.MAPIOBJECT = oAppl.GetNamespace("MAPI").MAPIOBJECT Set oUtils = CreateObject("Redemption.MAPIUtils") oUtils.MAPIOBJECT = oSession.MAPIOBJECT ' Set oFolder = oSession.GetDefaultFolder(olFolderContacts) lastMod = oFolder.fields(&H30080040) Debug.Print "UTC time: " & CStr(lastMod) lastMod = oUtils.HrGMTToLocal(lastMod) Debug.Print "local time: " & CStr(lastMod) |
#9
|
|||
|
|||
![]()
FWIW, I don't see PR_LAST_MODIFICATION_TIME on any .pst folders. Could that be the issue?
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Ken Slovak - [MVP - Outlook]" wrote in message ... Well, something's wrong. I'm not sure what. Using OutlookSpy and clicking on IMAPIFolder and scrolling down to PR_LAST_MODIFICATION_TIME (listed alphabetically among the named properties) I see a value there in GetProps in the default Contacts folder. I also see that property in every other folder in my mailbox, default or non-default. Where is your code running? What application is hosting that VBA? If it's Outlook VBA do not use CreateObject("Outlook.Application"), use the intrinsic Application object provided by the Outlook VBA. Use CreateObject only if running in some other VBA environment, such as Word or Excel VBA. "ck" wrote in message ... Ken, Thank you for the explanation and code snippet. I have Change - oSession.MAPIOBJECT = Application.Session.MAPIOBJECT To - oAppl.GetNamespace("MAPI").MAPIOBJECT The oFolder.Fields(&H30080040) still = Empty. Probably something is wrong with my Outlook. Just to confirm with you, i used OutlookSpy (IMAPIFolder) to check default contact folder. The GetProps tab doesn't have any PR_LAST_MODIFICATION_TIME property. How do you check the value? Thanks. My code: Dim oAppl As Outlook.Application Dim oSession As Redemption.RDOSession Dim oFolder As Redemption.RDOFolder Dim oUtils As Redemption.MAPIUtils Dim lastMod As Date ' Set oAppl = CreateObject("Outlook.Application") Set oSession = CreateObject("Redemption.RDOSession") 'oSession.MAPIOBJECT = Application.Session.MAPIOBJECT oSession.MAPIOBJECT = oAppl.GetNamespace("MAPI").MAPIOBJECT Set oUtils = CreateObject("Redemption.MAPIUtils") oUtils.MAPIOBJECT = oSession.MAPIOBJECT ' Set oFolder = oSession.GetDefaultFolder(olFolderContacts) lastMod = oFolder.fields(&H30080040) Debug.Print "UTC time: " & CStr(lastMod) lastMod = oUtils.HrGMTToLocal(lastMod) Debug.Print "local time: " & CStr(lastMod) |
#10
|
|||
|
|||
![]()
Bingo. Good eye, Sue.
I finally got a chance to log into a PST file profile (on Outlook 2007) and there was no PR_LAST_MODIFICATION_TIME property there in any of the folders. I'm surprised, but it seems that property is store provider dependent and not always there. -- 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 "Sue Mosher [MVP-Outlook]" wrote in message ... FWIW, I don't see PR_LAST_MODIFICATION_TIME on any .pst folders. Could that be the issue? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
OWA Public Calendar Modification | [email protected] | Outlook - Calandaring | 1 | August 31st 07 04:59 PM |
OWA Public Calendar Modification | [email protected] | Outlook - Calandaring | 0 | August 29th 07 05:18 PM |
Code modification help for moving | SCrowley | Outlook and VBA | 1 | May 11th 07 06:07 PM |
modification resolution | [email protected] | Outlook - Installation | 0 | April 30th 07 05:52 AM |
Outlook Archive Modification Date | eastcoasttech | Outlook - Installation | 1 | June 21st 06 07:43 PM |