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 » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Public Folder Apointment



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 8th 06, 11:17 PM posted to microsoft.public.outlook.program_vba
James Bond
external usenet poster
 
Posts: 1
Default Public Folder Apointment

Hello,

I have written an Function:

Public Function MakeAppointment(strOutlookFolderID As String, strSubject As
String, datDatum As Date, strLocation As String, strBody As String,
bolAllDay As Boolean, Optional strvon As String, Optional strbis As String,
Optional strOutlook As String) As String
5 On Error GoTo Handler
Dim olfolder As Outlook.MAPIFolder
Dim olApp As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim olns As Outlook.NameSpace
Dim myStoreID As String


10 Set olApp = CreateObject("Outlook.Application")
15 Set olns = olApp.GetNamespace("MAPI")
20 olns.Logon , , False, False
25 Set olfolder = olns.GetFolderFromID(strOutlookFolderID)

30 If Nz(strOutlook) = "" Then
35 Set objAppt = olfolder.Items.Add
40 Else
45 myStoreID = olfolder.StoreID
50 Set objAppt = olns.GetItemFromID(strOutlook, myStoreID)
55 End If

60 With objAppt
65 .Subject = strSubject
70 If Nz(Trim(strLocation)) "" Then
75 .Location = strLocation
80 End If
85 If bolAllDay = False Then
90 .start = CDate(datDatum & " " & strvon & ":00")
95 .End = CDate(datDatum & " " & strbis & ":00")
100 .AllDayEvent = False
105 Else
110 .start = datDatum
115 .AllDayEvent = True
120 End If

'recurring appointment
'.IsRecurring

125 .ReminderSet = False
130 .Body = strBody
'.Importance = olImportanceHigh
135 .Save
140 MakeAppointment = .EntryID
145 End With

150 olns.Logoff

155 Set objAppt = Nothing
160 Set olfolder = Nothing
165 Set olns = Nothing
170 Set olApp = Nothing
175 Exit Function
Handler:
Msgbox err.Number & vbnewline & err.Description
End Function

Sometimes I get an error in line 50, 25. I dont know why.
I think the IDs are right.

MFG
James
  #2  
Old April 9th 06, 04:28 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Public Folder Apointment

GetFolderFromID should also have a StoreID parameter if you're trying to access a folder in Public Folders.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"James Bond" u20653@uwe wrote in message news:5e7cc063ad1df@uwe...
Hello,

I have written an Function:

Public Function MakeAppointment(strOutlookFolderID As String, strSubject As
String, datDatum As Date, strLocation As String, strBody As String,
bolAllDay As Boolean, Optional strvon As String, Optional strbis As String,
Optional strOutlook As String) As String
5 On Error GoTo Handler
Dim olfolder As Outlook.MAPIFolder
Dim olApp As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim olns As Outlook.NameSpace
Dim myStoreID As String


10 Set olApp = CreateObject("Outlook.Application")
15 Set olns = olApp.GetNamespace("MAPI")
20 olns.Logon , , False, False
25 Set olfolder = olns.GetFolderFromID(strOutlookFolderID)

30 If Nz(strOutlook) = "" Then
35 Set objAppt = olfolder.Items.Add
40 Else
45 myStoreID = olfolder.StoreID
50 Set objAppt = olns.GetItemFromID(strOutlook, myStoreID)
55 End If

60 With objAppt
65 .Subject = strSubject
70 If Nz(Trim(strLocation)) "" Then
75 .Location = strLocation
80 End If
85 If bolAllDay = False Then
90 .start = CDate(datDatum & " " & strvon & ":00")
95 .End = CDate(datDatum & " " & strbis & ":00")
100 .AllDayEvent = False
105 Else
110 .start = datDatum
115 .AllDayEvent = True
120 End If

'recurring appointment
'.IsRecurring

125 .ReminderSet = False
130 .Body = strBody
'.Importance = olImportanceHigh
135 .Save
140 MakeAppointment = .EntryID
145 End With

150 olns.Logoff

155 Set objAppt = Nothing
160 Set olfolder = Nothing
165 Set olns = Nothing
170 Set olApp = Nothing
175 Exit Function
Handler:
Msgbox err.Number & vbnewline & err.Description
End Function

Sometimes I get an error in line 50, 25. I dont know why.
I think the IDs are right.

MFG
James

  #3  
Old April 9th 06, 05:53 PM posted to microsoft.public.outlook.program_vba
James Bond via OfficeKB.com
external usenet poster
 
Posts: 3
Default Public Folder Apointment

Sorry.?

What do you mean?

What must I change?

Sincerely,
James



Sue Mosher [MVP-Outlook] wrote:
GetFolderFromID should also have a StoreID parameter if you're trying to access a folder in Public Folders.

Hello,

[quoted text clipped - 63 lines]
MFG
James


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200604/1
  #4  
Old April 10th 06, 07:26 PM posted to microsoft.public.outlook.program_vba
Dave Kane [MVP - Outlook]
external usenet poster
 
Posts: 33
Default Public Folder Apointment

On line 25: to access a folder in Public Folders using GetFolderFromID you
need to supply the StoreID of the Public Folder sto
Set olfolder = olns.GetFolderFromID(strOutlookFolderID,
strPublicStoreID)
If you call GetFolderFromID without supplying the StoreID parameter then it
will only succeed when you supply the EntryID of a folder in the default
mail store (i.e. a folder in the mailbox)

"James Bond via OfficeKB.com" u20653@uwe wrote in message
news:5e867eedb3fc2@uwe...
Sorry.?

What do you mean?

What must I change?

Sincerely,
James



Sue Mosher [MVP-Outlook] wrote:
GetFolderFromID should also have a StoreID parameter if you're trying to
access a folder in Public Folders.

Hello,

[quoted text clipped - 63 lines]
MFG
James


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200604/1



  #5  
Old April 10th 06, 07:59 PM posted to microsoft.public.outlook.program_vba
James Bond via OfficeKB.com
external usenet poster
 
Posts: 3
Default Public Folder Apointment

Hello Dave,

thanks.

But I have some questions:

strOutlookFolderID is the internal Outlook String from the folder.

But what is then strPublicStoreID? I think it is the same or?

Sincerely,
James


Dave Kane [MVP - Outlook] wrote:
On line 25: to access a folder in Public Folders using GetFolderFromID you
need to supply the StoreID of the Public Folder sto
Set olfolder = olns.GetFolderFromID(strOutlookFolderID,
strPublicStoreID)
If you call GetFolderFromID without supplying the StoreID parameter then it
will only succeed when you supply the EntryID of a folder in the default
mail store (i.e. a folder in the mailbox)

Sorry.?

[quoted text clipped - 13 lines]
MFG
James


--
Message posted via http://www.officekb.com
  #6  
Old April 11th 06, 06:52 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Public Folder Apointment

The combination of EntryID + StoreID is guaranteed to uniquely identify a particular folder. store ID is also a long string, similar to, but not the same as the Entry ID. You can get it from any folder in the Public Folders hierarchy.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"James Bond via OfficeKB.com" u20653@uwe wrote in message news:5e942b0a78f92@uwe...
Hello Dave,

thanks.

But I have some questions:

strOutlookFolderID is the internal Outlook String from the folder.

But what is then strPublicStoreID? I think it is the same or?

Sincerely,
James


Dave Kane [MVP - Outlook] wrote:
On line 25: to access a folder in Public Folders using GetFolderFromID you
need to supply the StoreID of the Public Folder sto
Set olfolder = olns.GetFolderFromID(strOutlookFolderID,
strPublicStoreID)
If you call GetFolderFromID without supplying the StoreID parameter then it
will only succeed when you supply the EntryID of a folder in the default
mail store (i.e. a folder in the mailbox)

Sorry.?

[quoted text clipped - 13 lines]
MFG
James


--
Message posted via http://www.officekb.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
Public Folder Permission [email protected] Outlook - Calandaring 0 April 6th 06 10:57 PM
Public Folder forms hjoseph Outlook - Using Forms 1 February 27th 06 09:04 PM
Public Folder Issue Maurice Outlook - Calandaring 3 February 22nd 06 12:15 AM
How to change Categories property of recurring apointment? deko Outlook and VBA 3 January 23rd 06 07:18 AM
New message in Public Folder Leech Outlook and VBA 3 January 16th 06 05:36 PM


All times are GMT +1. The time now is 08:31 PM.


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.