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

Outlook Sharepoint Calendar stssync



 
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old April 14th 08, 03:10 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook Sharepoint Calendar stssync

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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Sean McPoland" wrote in message
...
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 ***


 




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
Custom fields with STSSync to Outlook Munir Outlook and VBA 6 December 8th 10 11:59 PM
Sharepoint calendar + Outlook calendar (drag/drop) P.Schuman Outlook - Calandaring 0 September 11th 07 07:14 AM
Event on STSSync? Munir Outlook and VBA 1 December 14th 06 01:36 PM
Enable Outlook '02 XP calendar to link to sharepoint calendar jnmkidd Outlook - Calandaring 1 July 28th 06 04:24 AM
How Outlook 2003 Stssync works Pavel Shilov Outlook - Using Contacts 5 March 15th 06 05:21 PM


All times are GMT +1. The time now is 08:55 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.