DocumentBase.SyncEvent, événement

Se produit lorsque la copie locale d'un document qui fait partie de l'espace de travail d'un document est synchronisée avec la copie sur le serveur.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word.v4.0.Utilities (dans Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntaxe

'Déclaration
Public Event SyncEvent As DocumentEvents2_SyncEventHandler
public event DocumentEvents2_SyncEventHandler SyncEvent

Exemples

L'exemple de code suivant détermine si le document fait partie de l'espace de travail d'un document. Si tel est le cas, le code attache un gestionnaire d'événements à l'événement SyncEvent qui affiche un message en cas d'échec de la synchronisation. Pour utiliser cet exemple, exécutez-le à partir de la classe ThisDocument dans un projet au niveau du document.

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

Sécurité .NET Framework

Voir aussi

Référence

DocumentBase Classe

Microsoft.Office.Tools.Word, espace de noms