Outlook Sharepoint Calendar stssync

S

Sean McPoland

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 ***
 
K

Ken Slovak - [MVP - Outlook]

This is a WebCal folder on SharePoint? Do you have permissions on the
folder?

Why are you using that NameSpace logon? Outlook can't change logons when
it's running. You also shouldn't be using NameSpace.Logoff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top