Condividi tramite


Proprietà DocumentBase.Sync

Ottiene un oggetto Sync che fornisce l'accesso ai metodi e alle proprietà di documenti inclusi in un'area di lavoro documenti.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Sintassi

'Dichiarazione
Public ReadOnly Property Sync As Sync
public Sync Sync { get; }

Valore proprietà

Tipo: Microsoft.Office.Core.Sync
Oggetto Sync che fornisce l'accesso ai metodi e alle proprietà di documenti inclusi in un'area di lavoro documenti.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come determinare se il documento fa parte di un'area di lavoro documenti.In caso affermativo, un gestore eventi viene collegato all'evento SyncEvent per visualizzare un messaggio se la sincronizzazione ha esito negativo.Per utilizzare questo esempio, eseguirlo dalla classe ThisDocument in un progetto a livello di documento.

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.");
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DocumentBase Classe

Spazio dei nomi Microsoft.Office.Tools.Word