G
Guest
I am creating a sub to open a shared .pst, copy the default calendar to the shared .PST, and then close it. However, I have found no way to directly reference the second .PST folder tree as there are now two folders named "Personal Folders". The code follows
Sub Export_Calendar(
Dim CurrentOutLook As New Outlook.Applicatio
Dim CurrentNameSpace As Outlook.NameSpac
' Return a reference to the MAPI layer
Set CurrentOutLook = Outlook.Applicatio
Set CurrentNameSpace = CurrentOutLook.GetNamespace("MAPI"
' Locate Calendar Folder to Cop
Set MyRootFolder = CurrentNameSpace.Folders("Personal Folders"
Set MyCalFolder = MyRootFolder.Folders("Calendar"
' Open/Create Shared .PS
CurrentNameSpace.AddStore ("c:\my documents\" & CurrentNameSpace.CurrentUser & ".pst"
' Copy Calendar Folder from first .PST to second .PS
' Set ExportCalFolder = MyCalFolder.CopyTo(????
' CurrentNameSpace.CloseStore (ExportTopFolder
End Su
I tried 'Set ExportRootFolder = CurrentNameSpace.AddStore("path"+filename)' to get a reference to the new store's root folder, but that did not work. Indicated "variable mistype"
Every example that I saw of the "CopyTo" method dealt with copying one folder to another within the same store, not to a different store
There must be someway to refer to the 2 "stores" seperately. I think I just need some way to reference the second store so that I can copy the Calendar Folder to it and then use "removestore" on it. Thanks
Sub Export_Calendar(
Dim CurrentOutLook As New Outlook.Applicatio
Dim CurrentNameSpace As Outlook.NameSpac
' Return a reference to the MAPI layer
Set CurrentOutLook = Outlook.Applicatio
Set CurrentNameSpace = CurrentOutLook.GetNamespace("MAPI"
' Locate Calendar Folder to Cop
Set MyRootFolder = CurrentNameSpace.Folders("Personal Folders"
Set MyCalFolder = MyRootFolder.Folders("Calendar"
' Open/Create Shared .PS
CurrentNameSpace.AddStore ("c:\my documents\" & CurrentNameSpace.CurrentUser & ".pst"
' Copy Calendar Folder from first .PST to second .PS
' Set ExportCalFolder = MyCalFolder.CopyTo(????
' CurrentNameSpace.CloseStore (ExportTopFolder
End Su
I tried 'Set ExportRootFolder = CurrentNameSpace.AddStore("path"+filename)' to get a reference to the new store's root folder, but that did not work. Indicated "variable mistype"
Every example that I saw of the "CopyTo" method dealt with copying one folder to another within the same store, not to a different store
There must be someway to refer to the 2 "stores" seperately. I think I just need some way to reference the second store so that I can copy the Calendar Folder to it and then use "removestore" on it. Thanks