![]() |
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
|
|||
|
|||
![]()
Anyone know how to create public calendars in vb or vbscript? I was
able to create public folders but not calendars. cyk. |
#2
|
|||
|
|||
![]()
If you don't specify the folder type with the Folders.Add method, it defaults
to the same type as the parent folder. Use the olDefaultFolders enumeration; with olDefaultFolderCalendar, you need to use 9 in vbscript: Set myNewFolder = myFolder.Folders.Add("My Public Calendar", 9) -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ " wrote: Anyone know how to create public calendars in vb or vbscript? I was able to create public folders but not calendars. cyk. |
#3
|
|||
|
|||
![]()
What should "myFolder" be bound to in your example?
Eric wrote: If you don't specify the folder type with the Folders.Add method, it defaults to the same type as the parent folder. Use the olDefaultFolders enumeration; with olDefaultFolderCalendar, you need to use 9 in vbscript: Set myNewFolder = myFolder.Folders.Add("My Public Calendar", 9) -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ " wrote: Anyone know how to create public calendars in vb or vbscript? I was able to create public folders but not calendars. cyk. |
#4
|
|||
|
|||
![]()
Bind it to the folder you want to create your folder under. Use:
NameSpace.GetDefaultFolder(18) Where 18 is the constant number for olDefaultFolders.olPublicFoldersAllPublicFolders. This will give you a top level folder, and you can use myFolder = MAPIFolder.Folders("FolderName") ad-infinitum to traverse the hierarchy to get a specific folder. You can also use a function like this to retrieve a MAPIFolder object if you know the full path: '************************************************* ***************************** 'Custom procedu OpenMAPIFolder(ByVal strPath) 'Purpose: Return a MAPIFolder from Path argument 'Returns: MAPIFolder object '************************************************* ***************************** Function OpenMAPIFolder(ByVal strPath) As Outlook.MAPIFolder On Error Resume Next Dim objFldr As MAPIFolder Dim strDir As String Dim strName As String Dim i As Integer If Left(strPath, Len("\")) = "\" Then strPath = Mid(strPath, Len("\") + 1) Else Set objFldr = Application.ActiveExplorer.CurrentFolder End If While strPath "" i = InStr(strPath, "\") If i Then strDir = Left(strPath, i - 1) strPath = Mid(strPath, i + Len("\")) Else strDir = strPath strPath = "" End If If objFldr Is Nothing Then Set objFldr = Application.GetNamespace("MAPI").Folders(strDir) On Error GoTo 0 Else Set objFldr = objFldr.Folders(strDir) End If Wend Set OpenMAPIFolder = objFldr End Function -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "cykill" wrote: What should "myFolder" be bound to in your example? Eric wrote: If you don't specify the folder type with the Folders.Add method, it defaults to the same type as the parent folder. Use the olDefaultFolders enumeration; with olDefaultFolderCalendar, you need to use 9 in vbscript: Set myNewFolder = myFolder.Folders.Add("My Public Calendar", 9) -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ " wrote: Anyone know how to create public calendars in vb or vbscript? I was able to create public folders but not calendars. cyk. |
#5
|
|||
|
|||
![]()
sorry, i'm new to vb. i don't quite understand. let say i want to
create a calendar called "Chicago", what would the code be like? below is my code to create a public folder. Dim objFolder As Object Dim szConnString As String Dim oSysInfo As ActiveDs.ADSystemInfo Dim szDomainDNSName As String Dim szStorageName As String ' Get the domain name. oSysInfo = New ActiveDs.ADSystemInfo szDomainDNSName = oSysInfo.DomainDNSName ' Get the storage name. szStorageName = "file://./backofficestorage/" + szDomainDNSName + "/" ' Create the folder. szConnString = szStorageName + "public folders/Conferences/" + szFolderName Try objFolder = CreateObject("CDO.Folder") Catch f As Exception System.Console.WriteLine("Error Creating Folder Object") End Try 'Set the folder properties. Try With objFolder .Description = "Root folder for " + szFolderName .ContentClass = "urn:content-classes:folder" ..Fields("http://schemas.microsoft.com/exchange/outlookfolderclass") = "IPF.Folders" .Fields.Update() .DataSource.SaveTo(szConnString) End With Catch e As Exception Exit Try objFolder = Nothing oSysInfo = Nothing End Try Eric wrote: Bind it to the folder you want to create your folder under. Use: NameSpace.GetDefaultFolder(18) Where 18 is the constant number for olDefaultFolders.olPublicFoldersAllPublicFolders. This will give you a top level folder, and you can use myFolder = MAPIFolder.Folders("FolderName") ad-infinitum to traverse the hierarchy to get a specific folder. You can also use a function like this to retrieve a MAPIFolder object if you know the full path: '************************************************* ***************************** 'Custom procedu OpenMAPIFolder(ByVal strPath) 'Purpose: Return a MAPIFolder from Path argument 'Returns: MAPIFolder object '************************************************* ***************************** Function OpenMAPIFolder(ByVal strPath) As Outlook.MAPIFolder On Error Resume Next Dim objFldr As MAPIFolder Dim strDir As String Dim strName As String Dim i As Integer If Left(strPath, Len("\")) = "\" Then strPath = Mid(strPath, Len("\") + 1) Else Set objFldr = Application.ActiveExplorer.CurrentFolder End If While strPath "" i = InStr(strPath, "\") If i Then strDir = Left(strPath, i - 1) strPath = Mid(strPath, i + Len("\")) Else strDir = strPath strPath = "" End If If objFldr Is Nothing Then Set objFldr = Application.GetNamespace("MAPI").Folders(strDir) On Error GoTo 0 Else Set objFldr = objFldr.Folders(strDir) End If Wend Set OpenMAPIFolder = objFldr End Function -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "cykill" wrote: What should "myFolder" be bound to in your example? Eric wrote: If you don't specify the folder type with the Folders.Add method, it defaults to the same type as the parent folder. Use the olDefaultFolders enumeration; with olDefaultFolderCalendar, you need to use 9 in vbscript: Set myNewFolder = myFolder.Folders.Add("My Public Calendar", 9) -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ " wrote: Anyone know how to create public calendars in vb or vbscript? I was able to create public folders but not calendars. cyk. |
#6
|
|||
|
|||
![]()
Oh, you're using CDOEX. This forum is for the Outlook Object Model. But
here's a thread in the appropriate newsgroup that has a code sample you can use: http://groups.google.com/group/micro...4da572f789d012 -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "cykill" wrote: sorry, i'm new to vb. i don't quite understand. let say i want to create a calendar called "Chicago", what would the code be like? below is my code to create a public folder. Dim objFolder As Object Dim szConnString As String Dim oSysInfo As ActiveDs.ADSystemInfo Dim szDomainDNSName As String Dim szStorageName As String ' Get the domain name. oSysInfo = New ActiveDs.ADSystemInfo szDomainDNSName = oSysInfo.DomainDNSName ' Get the storage name. szStorageName = "file://./backofficestorage/" + szDomainDNSName + "/" ' Create the folder. szConnString = szStorageName + "public folders/Conferences/" + szFolderName Try objFolder = CreateObject("CDO.Folder") Catch f As Exception System.Console.WriteLine("Error Creating Folder Object") End Try 'Set the folder properties. Try With objFolder .Description = "Root folder for " + szFolderName .ContentClass = "urn:content-classes:folder" ..Fields("http://schemas.microsoft.com/exchange/outlookfolderclass") = "IPF.Folders" .Fields.Update() .DataSource.SaveTo(szConnString) End With Catch e As Exception Exit Try objFolder = Nothing oSysInfo = Nothing End Try Eric wrote: Bind it to the folder you want to create your folder under. Use: NameSpace.GetDefaultFolder(18) Where 18 is the constant number for olDefaultFolders.olPublicFoldersAllPublicFolders. This will give you a top level folder, and you can use myFolder = MAPIFolder.Folders("FolderName") ad-infinitum to traverse the hierarchy to get a specific folder. You can also use a function like this to retrieve a MAPIFolder object if you know the full path: '************************************************* ***************************** 'Custom procedu OpenMAPIFolder(ByVal strPath) 'Purpose: Return a MAPIFolder from Path argument 'Returns: MAPIFolder object '************************************************* ***************************** Function OpenMAPIFolder(ByVal strPath) As Outlook.MAPIFolder On Error Resume Next Dim objFldr As MAPIFolder Dim strDir As String Dim strName As String Dim i As Integer If Left(strPath, Len("\")) = "\" Then strPath = Mid(strPath, Len("\") + 1) Else Set objFldr = Application.ActiveExplorer.CurrentFolder End If While strPath "" i = InStr(strPath, "\") If i Then strDir = Left(strPath, i - 1) strPath = Mid(strPath, i + Len("\")) Else strDir = strPath strPath = "" End If If objFldr Is Nothing Then Set objFldr = Application.GetNamespace("MAPI").Folders(strDir) On Error GoTo 0 Else Set objFldr = objFldr.Folders(strDir) End If Wend Set OpenMAPIFolder = objFldr End Function -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "cykill" wrote: What should "myFolder" be bound to in your example? Eric wrote: If you don't specify the folder type with the Folders.Add method, it defaults to the same type as the parent folder. Use the olDefaultFolders enumeration; with olDefaultFolderCalendar, you need to use 9 in vbscript: Set myNewFolder = myFolder.Folders.Add("My Public Calendar", 9) -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ " wrote: Anyone know how to create public calendars in vb or vbscript? I was able to create public folders but not calendars. cyk. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Public calendars | jmorc | Outlook - Calandaring | 4 | September 15th 06 07:01 PM |
Calendars in Public Folders | KimTxRx | Outlook - Calandaring | 0 | May 18th 06 07:39 PM |
Creating a Calendar in Exchange 5.5 Public Folders...Rights error. | Chris Stephens | Outlook - Calandaring | 1 | May 4th 06 02:32 PM |
Help with importing a creating contact list using vbscript | John Connor | Outlook - Using Contacts | 1 | April 27th 06 08:11 AM |
Public Calendars | Nikki | Outlook - Calandaring | 3 | February 24th 06 09:06 PM |