Class SyncObjects (Outlook VBA)

Contains a set of SyncObject objects representing the Send/Receive groups for a user. To use a SyncObjects class variable it first needs to be instantiated, for example


Dim sos as SyncObjects
Set sos = Session.SyncObjects

For Each

Here is an example of processing the SyncObjects items in a collection.


Dim sot As SyncObject
For Each sot In Session.SyncObjects
	
Next sot

AppFolders

This property returns the SyncObject object for application folders.

The SyncObject is where folders are automatically added when the InAppFolderSyncObject property of the Folder object is set to True. The SyncObject allows users to synchronize Microsoft Outlook folders, address books, and folder home pages for offline use.


Public Sub SetAppfolders() 
 
 Dim nsp As Outlook.NameSpace 
 
 Dim objSycs As Outlook.SyncObjects 
 
 Dim objSyc As Outlook.SyncObject 
 
 Dim mpfInbox As Outlook.Folder 
 
 
 
 Set nsp = Application.GetNamespace("MAPI") 
 
 Set objSycs = nsp.SyncObjects 
 
 Set objSyc = objSycs.AppFolders 
 
 Set mpfInbox = nsp.GetDefaultFolder(olFolderInbox) 
 
 mpfInbox.InAppFolderSyncObject = True 
 
 objSyc.Start 
 
End Sub

Class

Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for OlObjectClass.


Dim oocsClass As OlObjectClass
oocsClass = Session.SyncObjects.Class

Count

Returns a Long indicating the count of objects in the specified collection.


Dim lngCount As Long
lngCount = Session.SyncObjects.Count

Item

Returns a SyncObject object from the collection.

Item (Index)

Index: Either the index number of the object, or a value used to match the default property of an object in the collection.


Dim sot As SyncObject
Set sot = Session.SyncObjects(Index:=1)

Session

Returns the NameSpace object for the current session.

The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements do the same function: