View Single Post
  #1  
Old April 13th 08, 11:40 AM posted to microsoft.public.outlook.program_vba
Sean McPoland
external usenet poster
 
Posts: 1
Default Outlook Sharepoint Calendar stssync

Hi all,

I want to automate various processes through outlook to the Shared
Calendar in Sharepoint Services, using various bits of code I have found
around...I have come up with the following very basic Sub and Function
(where the meat is):

every time I run it however I get error Number: -2147352567 with
message: Invalid shared folder.

can anyone help? I think I've done everything right, just can't get past
the error...

the specific lines =

cro="stssync://tripleX/RBITCSPS/Lists/Calendar/calendar.aspx"
Set MAPIFolder = MAPISession.OpenSharedFolder(cro, Null, Null, Null)

Many thanks in advance
regards
Sean



'
' add a task/appointment to a calendar
'
Sub tester()
Dim x
x = FnAddtoCalendar
End Sub

Public Function FnAddtoCalendar() As Boolean

On Error GoTo ErrorHandler:

Dim MAPISession As Outlook.NameSpace
Dim MAPIFolder As Outlook.MAPIFolder
Dim MAPIMailItem As Outlook.MailItem

Dim blnSuccessful As Boolean

Dim cro As String

'Get the MAPI NameSpace object
Set MAPISession = Application.Session
If Not MAPISession Is Nothing Then

'Logon to the MAPI session
MAPISession.Logon , , True, False
'*****
cro = "stssync://tripleX/RBITCSPS/Lists/Calendar/calendar.aspx"

Set MAPIFolder = MAPISession.OpenSharedFolder(cro, Null, Null,
Null)
'*****
If Not MAPIFolder Is Nothing Then

Set MAPIFolder = Nothing

End If

MAPISession.Logoff

End If

'If we got to here, then we shall assume everything went ok.
blnSuccessful = True

ExitRoutine:
Set MAPISession = Nothing
FnAddtoCalendar = blnSuccessful

Exit Function

ErrorHandler:
MsgBox "An error has occured in the user defined Outlook VBA
function FnAddtoCalendar()" & vbCrLf & vbCrLf & _
"Error Number: " & CStr(Err.Number) & vbCrLf & _
"Error Description: " & Err.Description, vbApplicationModal
+ vbCritical
Resume ExitRoutine

End Function




*** Sent via Developersdex http://www.developersdex.com ***
Ads