Dela via


Document.Sync Property (2007 System)

Gets a Sync object that provides access to the methods and properties of documents that are part of a Document Workspace.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Sync As Sync
'Usage
Dim instance As Document 
Dim value As Sync 

value = instance.Sync
[BrowsableAttribute(false)]
public Sync Sync { get; }
[BrowsableAttribute(false)]
public:
property Sync^ Sync {
    Sync^ get ();
}
public function get Sync () : Sync

Property Value

Type: Sync
A Sync object that provides access to the methods and properties of documents that are part of a Document Workspace.

Examples

The following code example determines whether the document is part of a Document Workspace. If it is, the code attaches an event handler to the SyncEvent event that displays a message when the synchronization fails.

This example is for a document-level customization.

Private Sub DocumentSyncAndSyncEvent()
    If Me.Sync.Status = Office.MsoSyncStatusType.msoSyncStatusNoSharedWorkspace Then
        MessageBox.Show("The document is not part of a " & "shared document workspace.")
        Return 
    End If 
    AddHandler Me.SyncEvent, AddressOf ThisDocument_SyncEvent
End Sub 

Private Sub ThisDocument_SyncEvent(ByVal SyncEventType As Office.MsoSyncEventType)
    If SyncEventType = Office.MsoSyncEventType.msoSyncEventDownloadFailed _
        OrElse SyncEventType = Office.MsoSyncEventType.msoSyncEventUploadFailed Then
        MessageBox.Show("Document synchronization failed. " & _
            "Please contact your administrator.")
    End If 

End Sub
private void DocumentSyncAndSyncEvent()
{
    if (this.Sync.Status ==
        Office.MsoSyncStatusType.msoSyncStatusNoSharedWorkspace)
    {
        MessageBox.Show("The document is not part of a " +
            "shared document workspace.");
        return;
    }

    this.SyncEvent +=
        new Word.DocumentEvents2_SyncEventHandler(
        ThisDocument_SyncEvent);
}

void ThisDocument_SyncEvent(Office.MsoSyncEventType SyncEventType)
{
    if (SyncEventType ==
        Office.MsoSyncEventType.msoSyncEventDownloadFailed ||
        SyncEventType ==
        Office.MsoSyncEventType.msoSyncEventUploadFailed)
    {
        MessageBox.Show("Document synchronization failed. " +
            "Please contact your administrator.");
    }
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace